Updating the OpenJPA jar to 2.1 in my OpenEJB stack resolved the issue. All these tests passed whether shared-cache-mode was enabled or disabled. All suite tests passed with the cache enabled, although there seems to be version differences between 2.1's dependent jars and OpenEJB's deployed/repackaged versions, so I'm not giving up on 2.0.1 yet...
As an FYI, annotating the entities using org.apache.openjpa.persistence.DataCache made no difference under 2.0.1. Pinaki Poddar wrote: > > I can not determine the core assertion i.e. the 'expect' list and > 'result' list be equal because how the 'expect' list is formed is not > visible to me. > I included the code for building the expect list, the ejb methods do what they're supposed to do, and expect is what to expect. But I guess that's not the point. Pinaki Poddar wrote: > > 4. Another angle is Prepared Query Cache -- a mechanics used to cache a > query string when the same query is executed multiple times. It is known > to cause problems. To keep it out of the equation, switch it off by > openjpa.jdbc.QuerySQLCache=false > I usually have that off anyway, was playing with it as part of trying to figure out what was going on. BTW, when it's on, the log gets littered with 4625 PortfolioData WARN [main] openjpa.Runtime - Query "select e from Account e" is removed from cache excluded permanently. Query "select e from Account e" is not cached because its result is not obtained by executing a select statement. This can happen if the query was evaluated in-memory. The result was provided by org.apache.openjpa.datacache.QueryCacheStoreQuery$CachingResultObjectProvider. . And the database log shows the queries running regardless of the setting. As for the meat of your post. My EJB stack controls jdbc configuration, so I can't just Persistence.createEntityManagerFactory(...). I am reasonably sure my getEMF() will always return the same EntityManagerFactory instance, so no-can-do on any comparisons with multiple persistence contexts. So, next step is to create a JPA only project and exercise CriteriaQuery under 2.0.1. I'll report back any findings. But first, there's a nice cold beer with my name on it... -- View this message in context: http://openjpa.208410.n2.nabble.com/CriteriaQuery-with-shared-cache-mode-Enabled-Not-Working-tp6298760p6299969.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
