when SQLQuery.executeUpdate() called all second level cache will be invalidated.
Example:
SQLQuery query = session.createSQLQuery("UPDATE TABLE .....");
query.setInteger("status", 1);
query.executeUpdate();
To avoid:
SQLQuery query = session.createSQLQuery("UPDATE TABLE .....");
query.setInteger("status", 1);
query.addsynchronizedqueryspace("TABLE"); query.executeUpdate();
details here:
http://www.link-intersystems.com/bin/view/Blog/Hibernate's+second+level+cache+and+native+queries
Comments
Post a Comment