Skip to main content



      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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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.
Previous Topic:FileNotFoundException: tempToDelete.xml (Access is denied)
Next Topic:Using a Factory to create entity object instances
Goto Forum:
  


Current Time: Sun Aug 31 12:58:51 EDT 2025

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

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

Back to the top