org.hibernate.Query iterate() ignores query's setCacheMode setting
------------------------------------------------------------------
Key: HHH-3865
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3865
Project: Hibernate Core
Issue Type: Bug
Environment: Postgresql, core 3.3.1GA
Reporter: Erel Magnus
Priority: Critical
The code below allways takes data from cache even though it shouldn't.
org.hibernate.Query query = getSession().getNamedQuery("X");
query.setCacheMode(CacheMode.IGNORE);
return query.iterate();
After debugging for a bit, I found that what happens is that:
1. The query selects only the ID
2. next() method of iterator allways return proxy
3. Accessing the proxy loads the object, and does it according to the session settings and
not the query settings. In the above example it will load it from the cache.
The documentation states:
Override the current session cache mode, just for this query.
So from my understanding this includes also iterators that are part of the query.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira