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

For some queries, parameters are not found

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.4.2
    • Fix Version/s: None
    • Component/s: kernel
    • Labels:
      None

      Description

      I build a rather simple query using criteria API. I use the query a few times, there are no problems.
      I then re-use the query in another transaction, and get an error "declared parameters were not given values". Of course the values were given.
      So far I traced it to
      QueryImpl.assertParameters(StoreQuery, StoreQuery.Executor, java.util.Map) gets ordered parameter type map from the executor. That map should contain keys of type "ParameterExpression", but it instead contains keys of type String (with the correct parameter names and values, though).
      I don't know how those keys get there, by the time assertParameters() is executed, there are already there, and they are like 3 objects deep. I don't understand when are these objects updated, and which one is updated, and what can the reasons be.

      There are a few requirements:

      1. Criteria query must be used twice in one transaction
      2. A parameter value of null must have been used first

      There may be other combinations, but certainly if you use it with null, then with not null, then use it again in the next transaction, something happens with the internal structure. When joins where used, I saw even parser errors.

      Code is attached. Sorry for the JSP, it makes it easier for me to run JPA code in a server.

        Attachments

        1. temp.jsp
          2 kB
          Pawel Veselov

          Activity

            People

            • Assignee:
              struberg Mark Struberg
              Reporter:
              pveselov Pawel Veselov
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: