OpenJPA
  1. OpenJPA
  2. OPENJPA-1577

Using @Strategy in Queries not working properly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-beta2
    • Fix Version/s: 2.0.0-beta3
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ubuntu 9.10, Maven 2.2.1, Spring 3.0.1
    • Patch Info:
      Patch Available

      Description

      I try to use a field that is annotated with @Strategy in a Query.

      I expected that everytime the query is executed the toDataStoreValue method of the ValueHandler is called to prepare the correct values for the SQL query.
      This is only happens once. The next time the Query is executed the ValueHandler is not called.

      Here is the interesting part of the logging

      1st call:
      [DEBUG,Query,main] Executing query: [select s from SimpleEntity s where s.base = :base and s.name = :name] with parameters:

      {name=james, base=1}

      toDataStoreValue: 1
      [DEBUG,SQL,main] <t 805562662, conn 2071272094> executing prepstmnt 1531692262 SELECT t0.id, t0.version, t0.base, t0.street, t0.my_name FROM some_objects t0 WHERE (t0.base = ? AND t0.my_name = ?) [params=(String) base1, (String) james]

      2nd call:
      [DEBUG,Query,main] Executing query: [select s from SimpleEntity s where s.base = :base and s.name = :name] with parameters:

      {0=2, 1=henry}

      [DEBUG,SQL,main] <t 805562662, conn 2071272094> executing prepstmnt 106030716 SELECT t0.id, t0.version, t0.base, t0.street, t0.my_name FROM some_objects t0 WHERE (t0.base = ? AND t0.my_name = ?) [params=(String) 2, (String) henry]

      You can see that the parameter list has changed after the first call. Some kind of transformation (caching?) prevents calling the ValueHandler again.
      This is only a vague presumption.

      1. openjpa1577.tar
        7 kB
        Oliver Ringel
      2. OPENJPA-1577.patch
        8 kB
        Fay Wang
      3. OPENJPA-1577-1.patch
        8 kB
        Fay Wang

        Activity

        Oliver Ringel created issue -
        Oliver Ringel made changes -
        Field Original Value New Value
        Attachment openjpa1577.tar [ 12438911 ]
        Fay Wang made changes -
        Assignee Fay Wang [ faywang ]
        Fay Wang made changes -
        Attachment OPENJPA-1577.patch [ 12438956 ]
        Fay Wang made changes -
        Attachment OPENJPA-1577-1.patch [ 12438960 ]
        Donald Woods made changes -
        Fix Version/s 2.0.0 [ 12314019 ]
        Patch Info [Patch Available]
        Fay Wang made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Donald Woods made changes -
        Fix Version/s 2.0.0-beta3 [ 12314857 ]
        Fix Version/s 2.0.0 [ 12314019 ]
        Donald Woods made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Fay Wang
            Reporter:
            Oliver Ringel
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development