Skip to main content


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 10:16 Go to next message
Marcin Kwapisz is currently offline Marcin KwapiszFriend
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 11:45 Go to previous messageGo to next message
Marcin Kwapisz is currently offline Marcin KwapiszFriend
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 14:38 Go to previous message
James Sutherland is currently offline James SutherlandFriend
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: Tue Mar 19 09:34:20 GMT 2024

Powered by FUDForum. Page generated in 0.03374 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top