Hibernate version:core 3.1 - 3.3.1
Code : query = session.createSQLQuery(querySql) List resultList = query.list();
Full stack trace of any exception that occurs:none
Name and version of the database you are using:oracle 10g
The generated SQL (show_sql=true): sql might be: select a.* from A a, B b where a.f = b.f;
Debug level Hibernate log excerpt:
Hibernate SQL Query Cache
2008-10-8
Hibernate 3.1+, JDK 1.4
Is it a bug or do I misuse it ?
The bug occurs when using sencond level cache and query cache on SQL Query Cache. i.e. In a two-table-related SQL Query, cache is not updated when reference table is modified(create ,update, delete).
e.g.
Java code :
Q(A) = session.createSQLQuery(querySql)
hbm.xml, A,B both use cache .
The Query Q(A)=q{A,B} needs two tables A and B for data query , and table A as the resultset structure.
sql might be:
select a.* from A a, B b where a.f = b.f;
the query operation is:
List resultList = query.list();
When reference table B is modified, e.g. session.delete(b0) and the result of Q(A) should change. But the query result is the same. I guess the query cache isn't updated. Multiple-table-related query might be the same.
And I try to fix it by modifying class SQLCustomQuery myself. If it is a bug, I can post the code.
|