Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » javax.persistence.cache.retrieveMode does not work with Query
javax.persistence.cache.retrieveMode does not work with Query [message #507957] Fri, 15 January 2010 05:16 Go to next message
Marcin Kwapisz is currently offline Marcin Kwapisz
Messages: 14
Registered: January 2010
Junior Member
Hello,
I had problems with the second-level-cache and reading of stale entities (Topic: "Unexpected entity version number"). Now, I am a little bit wiser Wink, but have another problem.
I am not able to set javax.persistence.cache.retrieveMode for an entity manager (setProperty) and for a Query (setHint) (JSR317, chapter 3.7.2). But setting this hint for TypedQuery works without any problems. What is going on?

Regards
Marcin Kwapisz
Re: javax.persistence.cache.retrieveMode does not work with Query [message #507971 is a reply to message #507957] Fri, 15 January 2010 06:45 Go to previous messageGo to next message
Marcin Kwapisz is currently offline Marcin Kwapisz
Messages: 14
Registered: January 2010
Junior Member
Please, ignore that part of my previus post:
Quote:
But setting this hint for TypedQuery works without any problems. What is going on?



I was expecting my test to fail, but I did not check the real reason.
Hints for TypedQuery can not work because createNamedQuery is not supported in eclipselink:

 public <T> TypedQuery<T> createNamedQuery(String name, Class<T> resultClass){
        throw new UnsupportedOperationException();
    }


But the question is still actual: how to set javax.persistence.cache.retrieveMode for an EntityManager or a Query.

Regards
Marcin Kwapisz

Re: javax.persistence.cache.retrieveMode does not work with Query [message #508356 is a reply to message #507957] Mon, 18 January 2010 09:38 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

That is odd, please log a bug for createNamedQuery returning TypedQuery not implemented.

You can set the retrieveMode using a Query hint,

See,
http://www.eclipse.org/eclipselink/api/2.0/org/eclipse/persi stence/config/QueryHints.html

The JPA defined hint is,
"javax.persistence.cacheRetrieveMode"

but EclipseLink also offers several other hints to configure the cache usage.


James : Wiki : Book : Blog : Twitter
Previous Topic:FileNotFoundException: tempToDelete.xml (Access is denied)
Next Topic:Using a Factory to create entity object instances
Goto Forum:
  


Current Time: Thu Aug 28 21:32:07 EDT 2014

Powered by FUDForum. Page generated in 0.01923 seconds