rammic wrote:
I don't mean to thread-hijack, but would this have any relation to why I keep receiving
[TransactionSynch] Session already closed
messages in JBoss 4.0.0? I've never gotten these messages before (with the 3.2.x/hibernate setup) and it doesn't seem to affect the operation, but the fact that the message keeps appearing is a bit concerning.
Make sure you neither flush nor close session itself (this is intended to be done in TransactionSync on transaction commit, and this is a big advantage of using jboss-hibernate integration stuff).
Code:
   public void beforeCompletion()
   {
      if ( !session.isOpen() )
      {
         log.warn("Session already closed");
      }
      else
      {
         try
         {
            log.trace("Flushing Session");
            session.flush();
         }
         catch(Throwable t)
         {
            log.warn("Error flushing session");
         }
      }
   }
You see in case of closed session you miss managed flush completely.