[hibernate-issues] [Hibernate-JIRA] Assigned: (HHH-6599) Hibernate mark as rollback even for no transaction requests

Strong Liu (JIRA) noreply at atlassian.com
Mon Aug 29 01:56:05 EDT 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6599?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Strong Liu reassigned HHH-6599:
-------------------------------

    Assignee: Strong Liu

> Hibernate mark as rollback even for no transaction requests
> -----------------------------------------------------------
>
>                 Key: HHH-6599
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6599
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: entity-manager
>    Affects Versions: 3.6.7
>            Reporter: Alessandro Lazarotti
>            Assignee: Strong Liu
>
> When used a Hibernate EntityManager in a CMT Bean and a GenericJDBCException is launched, Hibernate will try a rollback even if there is not an active transaction, generating the exception: 
> <org.hibernate.ejb.AbstractEntityManagerImpl> Unable to mark for rollback on PersistenceException:
> java.lang.IllegalStateException: [com.arjuna.ats.internal.jta.transaction.arjunacore.nosuchtx] [com.arjuna.ats.internal.jta.transaction.arjunacore.nosuchtx] No such transaction!
>         at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.setRollbackOnly(BaseTransaction.java:188)
>         at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.setRollbackOnly(BaseTransactionManagerDelegate.java:135)
>         at org.hibernate.ejb.AbstractEntityManagerImpl.markAsRollback(AbstractEntityManagerImpl.java:440)
>         at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:595)
>         at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:637)
>         at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:74)
> ... hiding the original "Caused By" from the other Exception (GenericJDBCException).
> As example, a case where some error in runtime happens in a database procedure execution and the bean method is annotated as "NOT_SUPPORTED" transaction, this behaviour will happen and the original exception will be lost,  the root exception is overridden by "No such transaction" exception and so the cause is not reported in log files. Hibernate should not try a rollback if there is not a transaction.
> Fixing it is necessary update the method: 
> "protected void markAsRollback()"
> .. from org.hibernate.ejb.AbstractEntityManagerImpl.java
> That method just check no CMT JTA transaction:
> 		"if ( tx.isActive() ) {
> 			tx.setRollbackOnly();
> 		}"
> The same check is necessary for CMT JTA using transactionManager.getStatus and looking if it is different than Status.NoTransaction.
> This check should be done above the code that call transactionManager.setRollbackOnly();

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list