[hibernate-dev] Temporary session and commit issue with manual flush mode

Łukasz Antoniak lukasz.antoniak at gmail.com
Sun Feb 12 05:40:37 EST 2012

Hi all,

I have a question regarding SessionFactoryImplementor.openTemporarySession() (bug HHH-7017). As observed in non JTA environment 
with manual flush mode enabled, and 'hibernate.connection.autocommit' disabled, temporary session is not getting committed. 
How/when should I commit it manually? According to JavaDoc, it's "nontransactional". See the following log (H2):

11:19:01,531 DEBUG SQL:104 - insert into StrTestEntity_AUD (REVTYPE, str, id, REV) values (?, ?, ?, ?)
11:19:03,687  WARN SqlExceptionHelper:143 - SQL Error: 50200, SQLState: HYT00
Timeout trying to lock table "STRTESTENTITY_AUD"; SQL statement:
select strtestent0_.REV as col_0_0_ from StrTestEntity_AUD strtestent0_ cross join REVINFO defaultrev1_ where strtestent0_.id=? 
and strtestent0_.REV=defaultrev1_.REV order by strtestent0_.REV asc [50200-145]
	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:52)

Method AuditProcess.doBeforeTransactionCompletion() is responsible for persisting all audit data. The description in HHH-7017 is 
very accurate and correct. Please advice.

How is temporary session related to current normal session and its lifecycle?


More information about the hibernate-dev mailing list