[jboss-user] [EJB 3.0] - Entity bean state not rolled back on TX rollback:

jnorris10 do-not-reply at jboss.com
Thu Jul 13 18:40:09 EDT 2006

I have an entity bean with a "id" property annotated by:

  | @Id
  | @GeneratedValue

However, when this transaction fails with a database level deadlock and is rolled back (ie: EJBTransactionRolledbackException ...), the entity's "id" property is not rolled back and still has the database generated id value that it was given before the deadlock.  So it essentially becomes a detached entity with no real backing value in the database.

Shouldn't an entity bean's state be rolled back as well when the application TX is rolled back?  Is this a bug?

The rollback is initiated by a database deadlock and is described by the following exception stack:

  | javax.ejb.EJBTransactionRolledbackException
  | javax.persistence.PersistenceException
  | org.hibernate.exception.LockAcquisitionException: could not insert: ...
  | java.sql.SQLException: Deadlock found when trying to get lock; try restarting transaction

Let me know if you need more information to reproduce/investigate this...


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957915#3957915

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957915

More information about the jboss-user mailing list