javax.ejb.EJBTransactionRolledbackException: nested exception is: javax.transaction.RollbackException

Hibernate JIRA | Maxim S | 12 months ago
  1. 0

    An UnsupportedOperationException is thrown on WebSphere Liberty, if an entity is persisted with a value, that causes a constaint violation in database (for example, if a column cannot hold a too long value). Pseudo example: {code:java} /* * create table APP_JOBS { * ID NUMBER(*,0) NOT NULL PRIMARY KEY, * JOB VARCHAR2(10 CHAR) * } * / appJobsEntity.setJob("IAmTooLongForColumn"); @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) saveMethod(appJobsEntity) { em.save(appJobsEntity); } {code} //On save a exception is thrown: javax.ejb.EJBTransactionRolledbackException: nested exception is: javax.transaction.RollbackException at com.ibm.ejs.container.BusinessExceptionMappingStrategy.mapCSIException(BusinessExceptionMappingStrategy.java:124) at com.ibm.ejs.container.BusinessExceptionMappingStrategy.mapCSITransactionRolledBackException(BusinessExceptionMappingStrategy.java:584) at com.ibm.ejs.container.EJSDeployedSupport.mapCSITransactionRolledBackException(EJSDeployedSupport.java:600) at com.ibm.ejs.container.EJSContainer.postInvokeRolledbackException(EJSContainer.java:4382) at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:4073) .... Caused by: java.lang.UnsupportedOperationException at org.hibernate.engine.transaction.jta.platform.internal.WebSphereExtendedJtaPlatform$TransactionManagerAdapter.setRollbackOnly(WebSphereExtendedJtaPlatform.java:121) at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionAdapterTransactionManagerImpl.markRollbackOnly(JtaTransactionAdapterTransactionManagerImpl.java:100) Unlike the prior versions WebSphere Liberty 8.5.5.7 seems to provide access to the TransactionManager to support the rollback operation. Suggested improvement of Hibernate: Add a WebSphereLibertyJtaPlatform like the one below (working example; jndi lookup didnt worked in my environment): {code:java} import javax.transaction.TransactionManager; import javax.transaction.UserTransaction; import org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform; //Get rid of this dependencies with reflection import com.ibm.tx.jta.TransactionManagerFactory; import com.ibm.tx.jta.UserTransactionFactory; public class WebSphereLibertyJtaPlatform extends AbstractJtaPlatform { @Override protected TransactionManager locateTransactionManager() { return TransactionManagerFactory.getTransactionManager(); } @Override protected UserTransaction locateUserTransaction() { return UserTransactionFactory.getUserTransaction(); } } {code}

    Hibernate JIRA | 12 months ago | Maxim S
    javax.ejb.EJBTransactionRolledbackException: nested exception is: javax.transaction.RollbackException
  2. 0

    An UnsupportedOperationException is thrown on WebSphere Liberty, if an entity is persisted with a value, that causes a constaint violation in database (for example, if a column cannot hold a too long value). Pseudo example: {code:java} /* * create table APP_JOBS { * ID NUMBER(*,0) NOT NULL PRIMARY KEY, * JOB VARCHAR2(10 CHAR) * } * / appJobsEntity.setJob("IAmTooLongForColumn"); @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) saveMethod(appJobsEntity) { em.save(appJobsEntity); } {code} //On save a exception is thrown: javax.ejb.EJBTransactionRolledbackException: nested exception is: javax.transaction.RollbackException at com.ibm.ejs.container.BusinessExceptionMappingStrategy.mapCSIException(BusinessExceptionMappingStrategy.java:124) at com.ibm.ejs.container.BusinessExceptionMappingStrategy.mapCSITransactionRolledBackException(BusinessExceptionMappingStrategy.java:584) at com.ibm.ejs.container.EJSDeployedSupport.mapCSITransactionRolledBackException(EJSDeployedSupport.java:600) at com.ibm.ejs.container.EJSContainer.postInvokeRolledbackException(EJSContainer.java:4382) at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:4073) .... Caused by: java.lang.UnsupportedOperationException at org.hibernate.engine.transaction.jta.platform.internal.WebSphereExtendedJtaPlatform$TransactionManagerAdapter.setRollbackOnly(WebSphereExtendedJtaPlatform.java:121) at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionAdapterTransactionManagerImpl.markRollbackOnly(JtaTransactionAdapterTransactionManagerImpl.java:100) Unlike the prior versions WebSphere Liberty 8.5.5.7 seems to provide access to the TransactionManager to support the rollback operation. Suggested improvement of Hibernate: Add a WebSphereLibertyJtaPlatform like the one below (working example; jndi lookup didnt worked in my environment): {code:java} import javax.transaction.TransactionManager; import javax.transaction.UserTransaction; import org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform; //Get rid of this dependencies with reflection import com.ibm.tx.jta.TransactionManagerFactory; import com.ibm.tx.jta.UserTransactionFactory; public class WebSphereLibertyJtaPlatform extends AbstractJtaPlatform { @Override protected TransactionManager locateTransactionManager() { return TransactionManagerFactory.getTransactionManager(); } @Override protected UserTransaction locateUserTransaction() { return UserTransactionFactory.getUserTransaction(); } } {code}

    Hibernate JIRA | 12 months ago | Maxim S
    javax.ejb.EJBTransactionRolledbackException: nested exception is: javax.transaction.RollbackException
  3. 0

    Unable to insert row into table

    Google Groups | 8 years ago | joachi...@gmx.net
    javax.ejb.EJBTransactionRolledbackException:
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.ejb.EJBTransactionRolledbackException

      nested exception is: javax.transaction.RollbackException

      at com.ibm.ejs.container.BusinessExceptionMappingStrategy.mapCSIException()
    2. com.ibm.ejs
      EJSContainer.postInvoke
      1. com.ibm.ejs.container.BusinessExceptionMappingStrategy.mapCSIException(BusinessExceptionMappingStrategy.java:124)
      2. com.ibm.ejs.container.BusinessExceptionMappingStrategy.mapCSITransactionRolledBackException(BusinessExceptionMappingStrategy.java:584)
      3. com.ibm.ejs.container.EJSDeployedSupport.mapCSITransactionRolledBackException(EJSDeployedSupport.java:600)
      4. com.ibm.ejs.container.EJSContainer.postInvokeRolledbackException(EJSContainer.java:4382)
      5. com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:4073)
      5 frames