Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-1577

Using @Strategy in Queries not working properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0-beta2
    • 2.0.0-beta3
    • None
    • None
    • Ubuntu 9.10, Maven 2.2.1, Spring 3.0.1
    • 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.

      Attachments

        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

          People

            faywang Fay Wang
            oringel Oliver Ringel
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: