Hi guys,
Why method TransactionImpl.rollback() calls Session.clear() ? I mean, I'd like to keep my first level cache even after rollback and it's not happening.
public void rollback() { if ( tx == null || !tx.isActive() ) { throw new IllegalStateException( "Transaction not active" ); } try { tx.rollback(); } catch (Exception e) { throw new PersistenceException( "unexpected error when rollbacking", e ); } finally { try { if (entityManager != null) { Session session = getSession(); if ( session != null && session.isOpen() ) session.clear(); } } catch (Throwable t) { //we don't really care here since it's only for safety purpose } rollbackOnly = false; } }
Thanks, Rogerio
|