Kevin Sutter created OPENJPA-2176:
-------------------------------------
Summary: QuerySQLCache not processing prepared sql correctly
Key: OPENJPA-2176
URL: https://issues.apache.org/jira/browse/OPENJPA-2176
Project: OpenJPA
Issue Type: Bug
Components: query
Affects Versions: 2.0.3, 2.1.2, 2.3.0, 2.2.1
Reporter: Kevin Sutter
Opening this JIRA on behalf of a user e-mailing me with this question... The
workaround for this problem is to disable the QuerySQLCache either via a
property in the persistence.xml or on an individual query basis via the
setQueryHint invocation. A description of the problem follows:
I have a JPQL like this:
SELECT catentry FROM CatalogEntry catentry WHERE catentry.catalogEntryId
IN(:catalogEntryId)
- catalogEntryId is of type long.
- I am trying to set the named query parameter 'catalogEntryId' from my code
using query.setParameter("catalogEntryId", list of catalogEntryIds)
- I am ensuring that the list of catalogEntryIds that I am setting is always a
list of type java.lang.Long. I am using wrappers/objects rather than
primitives. But I think that should be OK, as the same is mentioned in the
OpenJPA manual.
The issue is:
- When I start my server (on WAS), it works fine for the very first time. So
let's say I pass 10459 & 10460 as catalogEntryIds, I get the entities
corresponding to both the ids.
- But for subsequent requests, only one entity is returned mostly for the last
id(10460) in the list. There are no errors/exceptions thrown. I have in fact
started the server in debug mode and checked the exact values set in the query
object. The "boundParams" in the QueryImpl has the list of
catalogEntryIds(10459 & 10460) that I have set.
- The issue is even more strange when I try to set a list of entities using the
IN() expression in another query which takes a list of entities as the query
parameter. It works for the very first time and then for subsequent requests it
throws an exception saying parameter not supported/ invalid parameter...
Another strange behavior is that all the above works absolutely fine, when I
launch the similar code in a stand alone J2SE platform, typically using a JUNIT
test case.
This problem looks very basic for a J2EE environment, I am hoping this is a
known issue and you have a fix already?
About my environment:
- I am running with 1.0.0.5 of the OSGi/JPA 2.0 Feature Pack on top of WAS v7
- I have also set dataCache/queryCache to false hoping that would yield
successful result, but did not help. Seems like they are by default disabled?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira