My application needs to execute a non query sql statement, but Hibernate tries to clean my L2 cache whenever I execute a nonquery . I found the following in the source code in BasicExecutor.java. Anyone knows why Hibernate is clearing the cache? and how can I avoid that? Thanks.
Code:
public int execute(QueryParameters parameters, SessionImplementor session) throws HibernateException {
coordinateSharedCacheCleanup( session );
PreparedStatement st = null;
RowSelection selection = parameters.getRowSelection();
try {
try {
st = session.getBatcher().prepareStatement( sql );
Iterator paramSpecifications = getWalker().getParameters().iterator();
int pos = 1;
while ( paramSpecifications.hasNext() ) {
final ParameterSpecification paramSpec = ( ParameterSpecification ) paramSpecifications.next();
pos += paramSpec.bind( st, parameters, session, pos );
}
if ( selection != null ) {
............
}