ALTER SESSION queries cause the hibernate second level cache to be cleared
--------------------------------------------------------------------------
Key: HHH-3977
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3977
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.3.1
Environment: Hibernate 3.3.1GA
Oracle 10g
Reporter: hard hat
Priority: Minor
When issuing an ALTER SESSION statement to oracle, this causes hibernate to think that the
second level cache got dirty and the cache is cleared.
Example:
----------------------------------------------------------------------------------------------------------------------------
session.beginTransaction();
// set date format
SQLQuery sqlQuery = session.createSQLQuery("alter session set
nls_date_format='DD/MM/YYYY");
sqlQuery.executeUpdate();
// query something
Query query = session.createQuery("from Person");
// -- at this point, all queried person objects are in the 2nd level cache,
// you can check this, if you stop here with the debugger and list the cache
statistics
// close session
session.getTransaction().rollback();
// -- at this point, all Person elements are gone from the cache, which
// you can once again check by looking at the cache statistics
----------------------------------------------------------------------------------------------------------------------------
Without the ALTER SESSION statement, the 2nd level cache is populated with the loaded
elements.
--
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