Pawel Veselov created OPENJPA-2769:
--------------------------------------

             Summary: For some queries, parameters are not found
                 Key: OPENJPA-2769
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2769
             Project: OpenJPA
          Issue Type: Bug
          Components: kernel
    Affects Versions: 2.4.2
            Reporter: Pawel Veselov
         Attachments: temp.jsp

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:
# Criteria query must be used twice in one transaction
# 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.





--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to