The prepareTransaction method already suppresses hibernate flushing for a read-only transaction by setting session flush mode to FlushMode.MANUAL. Shouldn't this method also call session.setDefaultReadOnly(readOnly) to tell the hibernate session to not waste resources on tracking entities that will never be flushed?
I would insert the line
session.setDefaultReadOnly(readOnly);
just before
return new SessionTransactionData(session, previousFlushMode);
I am looking at spring 3.2.2 source.
I would insert the line
session.setDefaultReadOnly(readOnly);
just before
return new SessionTransactionData(session, previousFlushMode);
I am looking at spring 3.2.2 source.