To clarify my problem a bit. This is what he does at org.springframework.orm debug logging level.
First I do the method testCreateGebruiker in my first testcase. Secondly I do the same method again but in a second testcase this time.
testGebruiker
Code:
[08:42:52,031] INFO org.springframework.orm.hibernate.LocalSessionFactoryBean - Building new Hibernate SessionFactory
[08:42:54,484] INFO org.springframework.orm.hibernate.HibernateTransactionManager - Using DataSource [org.apache.commons.dbcp.BasicDataSource@305acd] from Hibernate SessionFactory for HibernateTransactionManager
[08:42:54,984] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Using transaction object [org.springframework.orm.hibernate.HibernateTransactionObject@70be88]
[08:42:55,000] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Creating new transaction
[08:42:55,046] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Opening Hibernate session
[08:42:55,218] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Opened new session [net.sf.hibernate.impl.SessionImpl@2c5f13] for Hibernate transaction
[08:42:55,234] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Beginning Hibernate transaction on session [net.sf.hibernate.impl.SessionImpl@2c5f13]
[08:42:55,265] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Triggering beforeCommit synchronization
[08:42:55,281] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Triggering beforeCompletion synchronization
[08:42:55,281] INFO org.springframework.orm.hibernate.HibernateTransactionManager - Initiating transaction commit
[08:42:55,312] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Committing Hibernate transaction on session [net.sf.hibernate.impl.SessionImpl@2c5f13]
[08:42:55,531] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Triggering afterCompletion synchronization
[08:42:55,546] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Closing Hibernate session [net.sf.hibernate.impl.SessionImpl@2c5f13] after transaction
[08:42:55,562] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Closing Hibernate session
[08:42:55,562] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Using transaction object [org.springframework.orm.hibernate.HibernateTransactionObject@76f27b]
[08:42:55,578] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Creating new transaction
[08:42:55,578] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Opening Hibernate session
[08:42:55,593] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Opened new session [net.sf.hibernate.impl.SessionImpl@299347] for Hibernate transaction
[08:42:55,609] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Beginning Hibernate transaction on session [net.sf.hibernate.impl.SessionImpl@299347]
[08:42:55,828] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Triggering beforeCommit synchronization
[08:42:55,828] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Triggering beforeCompletion synchronization
[08:42:55,843] INFO org.springframework.orm.hibernate.HibernateTransactionManager - Initiating transaction commit
[08:42:55,843] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Committing Hibernate transaction on session [net.sf.hibernate.impl.SessionImpl@299347]
[08:42:55,859] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Triggering afterCompletion synchronization
[08:42:55,875] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Closing Hibernate session [net.sf.hibernate.impl.SessionImpl@299347] after transaction
[08:42:55,890] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Closing Hibernate session
testSysteemCode:
[08:43:01,390] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Using transaction object [org.springframework.orm.hibernate.HibernateTransactionObject@45e5a6]
[08:43:01,406] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Creating new transaction
[08:43:01,406] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Opening Hibernate session
[08:43:01,421] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Opened new session [net.sf.hibernate.impl.SessionImpl@680761] for Hibernate transaction
[08:43:01,421] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Beginning Hibernate transaction on session [net.sf.hibernate.impl.SessionImpl@680761]
[08:43:01,437] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Opening Hibernate session
[08:43:01,453] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Registering Spring transaction synchronization for Hibernate session
[08:43:01,453] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Triggering beforeCommit synchronization
[08:43:01,515] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Flushing Hibernate session on transaction synchronization
[08:43:01,593] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Triggering beforeCompletion synchronization
[08:43:01,593] INFO org.springframework.orm.hibernate.HibernateTransactionManager - Initiating transaction commit
[08:43:01,593] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Committing Hibernate transaction on session [net.sf.hibernate.impl.SessionImpl@680761]
[08:43:01,609] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Triggering afterCompletion synchronization
[08:43:01,609] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Closing Hibernate session
[08:43:01,625] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Closing Hibernate session [net.sf.hibernate.impl.SessionImpl@680761] after transaction
[08:43:01,640] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Closing Hibernate session
[08:43:01,640] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Using transaction object [org.springframework.orm.hibernate.HibernateTransactionObject@391da0]
[08:43:01,656] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Creating new transaction
[08:43:01,656] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Opening Hibernate session
[08:43:01,671] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Opened new session [net.sf.hibernate.impl.SessionImpl@47f37d] for Hibernate transaction
[08:43:01,671] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Beginning Hibernate transaction on session [net.sf.hibernate.impl.SessionImpl@47f37d]
[08:43:01,687] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Opening Hibernate session
[08:43:01,687] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Registering Spring transaction synchronization for Hibernate session
[08:43:01,765] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Triggering beforeCommit synchronization
[08:43:01,781] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Flushing Hibernate session on transaction synchronization
[08:43:01,796] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Triggering beforeCompletion synchronization
[08:43:01,812] INFO org.springframework.orm.hibernate.HibernateTransactionManager - Initiating transaction commit
[08:43:01,812] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Committing Hibernate transaction on session [net.sf.hibernate.impl.SessionImpl@47f37d]
[08:43:01,828] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Triggering afterCompletion synchronization
[08:43:01,843] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Closing Hibernate session
[08:43:01,843] DEBUG org.springframework.orm.hibernate.HibernateTransactionManager - Closing Hibernate session [net.sf.hibernate.impl.SessionImpl@47f37d] after transaction
[08:43:01,875] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Closing Hibernate session
After some other testcases he throws the following exception :
Code:
java.lang.IllegalStateException: No Hibernate Session bound to thread, and configuration does not allow creation of new one here