10 Replies Latest reply on Aug 11, 2006 10:58 AM by smithbstl

    Built in JTA Transactions work - sometimes

      This is a repost from the Hibernate forum - never got a response

      I am using Hibernate 3.1 with Har deployment in JBoss 4.0.4 GA

      When I obtain a transaction from Hibernate, only some of the transactions are updating the database. Below is the server log from an unsuccessful transaction followed by a successful transaction. From the log it looks like transactions are only being committed when a new JTA transaction is created vs an existing one being obtained? I can post any code if it would help. I am working from Hibernate In Action and the "JBoss At Work" O'Reilly book. Thanks everyone!

      Successful Transaction
      2006-08-10 11:55:54,031 INFO [STDOUT] Update Called
      2006-08-10 11:55:54,031 INFO [STDOUT] ***Account Save***
      2006-08-10 11:55:54,031 INFO [STDOUT] AcctID: 325
      2006-08-10 11:55:54,031 INFO [STDOUT] AcctNum: 5106
      2006-08-10 11:55:54,031 INFO [STDOUT] AcctName: Test3
      2006-08-10 11:55:54,031 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] JNDI lookup: hibernate/SessionFactory
      2006-08-10 11:55:54,031 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] lookup: uid=402882a50cf90095010cf900970d0000
      2006-08-10 11:55:54,031 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
      2006-08-10 11:55:54,031 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 4731817795710976
      2006-08-10 11:55:54,031 DEBUG [org.hibernate.transaction.JTATransaction] Looking for UserTransaction under: UserTransaction
      2006-08-10 11:55:54,031 DEBUG [org.hibernate.transaction.JTATransaction] Obtained UserTransaction
      2006-08-10 11:55:54,031 DEBUG [org.hibernate.transaction.JTATransaction] begin
      2006-08-10 11:55:54,031 DEBUG [org.hibernate.transaction.JTATransaction] commit

      Successful Transaction
      2006-08-10 11:56:14,578 INFO [STDOUT] Update Called
      2006-08-10 11:56:14,578 INFO [STDOUT] ***Account Save***
      2006-08-10 11:56:14,578 INFO [STDOUT] AcctID: 167
      2006-08-10 11:56:14,578 INFO [STDOUT] AcctNum: 5104
      2006-08-10 11:56:14,578 INFO [STDOUT] AcctName: Salaries - Adjustments
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] JNDI lookup: hibernate/SessionFactory
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] lookup: uid=402882a50cf90095010cf900970d0000
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.jdbc.JDBCContext] TransactionFactory reported no active transaction; Synchronization not registered
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 4731817879871488
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.transaction.JTATransaction] Looking for UserTransaction under: UserTransaction
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.transaction.JTATransaction] Obtained UserTransaction
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.transaction.JTATransaction] begin
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.transaction.JTATransaction] Began a new JTA transaction
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.transaction.JTATransaction] commit
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] processing flush-time cascades
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] dirty checking collections
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.pretty.Printer] listing entities:
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.pretty.Printer] com.stlouiscity.budget.database.beans.AccountBean{acctNum=5104, acctName=Salaries - Adjustments, acctId=167}
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
      2006-08-10 11:56:14,578 DEBUG [org.hibernate.jdbc.ConnectionManager] opening JDBC connection
      2006-08-10 11:56:14,625 DEBUG [org.hibernate.SQL] update Budget.Account set Acct_Num=?, Acct_Name=? where Acct_ID=?
      2006-08-10 11:56:14,625 INFO [STDOUT] Hibernate: update Budget.Account set Acct_Num=?, Acct_Name=? where Acct_ID=?
      2006-08-10 11:56:14,625 DEBUG [org.hibernate.jdbc.AbstractBatcher] Executing batch size: 1
      2006-08-10 11:56:14,625 DEBUG [org.hibernate.jdbc.AbstractBatcher] success of batch update unknown: 0
      2006-08-10 11:56:14,625 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
      2006-08-10 11:56:14,625 DEBUG [org.hibernate.jdbc.ConnectionManager] skipping aggressive-release due to flush cycle
      2006-08-10 11:56:14,625 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
      2006-08-10 11:56:14,625 DEBUG [org.hibernate.jdbc.ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
      2006-08-10 11:56:14,625 DEBUG [org.hibernate.transaction.JTATransaction] Committed JTA UserTransaction