Delete operation in afterTrasnactionCommit raises exceptionSpring Transaction propagation issueStaleObjectStateException with Hibernate in read operation?Issue with @Transactional annotations in Spring JPABest practice for open/get Hibernate session in Spring 4 + Hibernate 4.3.1.finalSpring JPARepository hangs when doing a query to Postgresql databaseSpring4 @Scheduled @Transaction throws no transaction is in progress at flush for mutliple dataSourcesUpdating Column of OneToOne with Spring RepoJpaTransactionManager transactions not used by Hibernate Session@Rollback is not working in Spring+Hibernate+Junit testingSpring Boot JPA Hibernate + persistence.xml Not Inserting
"My boss was furious with me and I have been fired" vs. "My boss was furious with me and I was fired"
What to do with someone that cheated their way through university and a PhD program?
What makes accurate emulation of old systems a difficult task?
A faster way to compute the largest prime factor
Creating a chemical industry from a medieval tech level without petroleum
Extracting Dirichlet series coefficients
Crossed out red box fitting tightly around image
Where was the County of Thurn und Taxis located?
Why do real positive eigenvalues result in an unstable system? What about eigenvalues between 0 and 1? or 1?
What does "function" actually mean in music?
How to keep bees out of canned beverages?
Find the identical rows in a matrix
Why doesn't the standard consider a template constructor as a copy constructor?
How much cash can I safely carry into the USA and avoid civil forfeiture?
What is the unit of time_lock_delta in LND?
Can I criticise the more senior developers around me for not writing clean code?
Cayley's Matrix Notation
What does MLD stand for?
Drawing a german abacus as in the books of Adam Ries
Unknown code in script
Is there a word for the censored part of a video?
Retract an already submitted recommendation letter (written for an undergrad student)
All ASCII characters with a given bit count
What is the term for a person whose job is to place products on shelves in stores?
Delete operation in afterTrasnactionCommit raises exception
Spring Transaction propagation issueStaleObjectStateException with Hibernate in read operation?Issue with @Transactional annotations in Spring JPABest practice for open/get Hibernate session in Spring 4 + Hibernate 4.3.1.finalSpring JPARepository hangs when doing a query to Postgresql databaseSpring4 @Scheduled @Transaction throws no transaction is in progress at flush for mutliple dataSourcesUpdating Column of OneToOne with Spring RepoJpaTransactionManager transactions not used by Hibernate Session@Rollback is not working in Spring+Hibernate+Junit testingSpring Boot JPA Hibernate + persistence.xml Not Inserting
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am running within the context of an afterTransactionCommit. I have a method, which is marked as @Transactional(propagation = REQUIRED). The method is using a JPA EntityManager to perform the delete operation, which is delegating to Hibernate 5 running within a Spring 4.3 container. There are more the 10 operations being executed in the afterTransactionCommit. Each delete completes successfully except for the 10th which consistently fails. This operation was completing successfully using Hibernate 3.6.x but since I've upgraded to Hibernate 5.4.x the operation no longer completes successfully.
After enabling DEBUG logging I can see that the transaction is still active and that the TransactionManager found the EntityManager for the JPA transaction. The Transaction was found to be active and the operation is going to participate in the existing transaction. But when the 10th delete operation is encountered the TransactionManger shows that were was a failure participating in the existing transaction and the transaction is then marked for rollback.
I'm unable to determine what is causing the failure.
Has anyone encountered something like this previously?
Log file below.
2019-03-22 09:00:32,692 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,692 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,725 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,725 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,735 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,736 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,736 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,736 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,266 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - /* DELETE FROM DObjReference AS o WHERE o.instanceId = :instanceId AND o.referencingObjectType = :referencingObjectType AND o. referencingObjectKey = :referencingObjectKey AND o.referencingParentKey = :referencingParentKey / delete from d_obj_reference where instance_id=? and referencing_object_type=? and referencing_object_key=? and referencing_parent_key=?
2019-03-22 09:00:33,278 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,278 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,283 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - / SELECT attributeKey FROM Attribute AS o WHERE o.instanceId = :instanceId / select attrib0_.attribute_key as col_0_0_ from attribute attrib0_ where attrib0_.instance_id=?
2019-03-22 09:00:33,295 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,295 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,323 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,323 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:34,133 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - / DELETE FROM DObjReference AS o WHERE o.instanceId = :instanceId AND o.referencingObjectType = :referencingObjectType AND o. referencingObjectKey = :referencingObjectKey AND o.referencingParentKey = :referencingParentKey / delete from d_obj_reference where instance_id=? and referencing_object_type=? and referencing_object_key=? and referencing_parent_key=?
2019-03-22 09:00:34,145 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:34,145 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:34,150 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - / SELECT attributeKey FROM Attribute AS o WHERE o.instanceId = :instanceId */ select attrib0_.attribute_key as col_0_0_ from attribute attrib0_ where attrib0_.instance_id=?
2019-03-22 09:00:34,226 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Initiating transaction commit
2019-03-22 09:00:34,226 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Committing JPA transaction on EntityManager [SessionImpl(1808876088)]
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:05:46,949 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating transaction failed - marking existing transaction as rollback-only
2019-03-22 09:05:46,950 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Setting JPA transaction on EntityManager [SessionImpl(1808876088)] rollback-only
2019-03-22 09:05:46,952 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating transaction failed - marking existing transaction as rollback-only
2019-03-22 09:05:46,953 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Setting JPA transaction on EntityManager [SessionImpl(1808876088)] rollback-only
2019-03-22 09:05:53,089 [main sessionId: vaultId: userId: origReqUri:] ERROR domain.impl.ObjectRepositoryImpl - [INFO - General] - Exception caught while executing observer. Since this is post-commit, it will be skipped!
org.springframework.dao.InvalidDataAccessApiUsageException: Executing an update/delete query; nested exception is javax.persistence.TransactionRequiredException: Executing an update/delete query
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:413)
at org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect.ajc$afterThrowing$org_springframework_orm_jpa_aspectj_JpaExceptionTranslatorAspect$1$18a1ac9(JpaExceptionTranslatorAspect.aj:37)
spring hibernate spring-transactions
add a comment |
I am running within the context of an afterTransactionCommit. I have a method, which is marked as @Transactional(propagation = REQUIRED). The method is using a JPA EntityManager to perform the delete operation, which is delegating to Hibernate 5 running within a Spring 4.3 container. There are more the 10 operations being executed in the afterTransactionCommit. Each delete completes successfully except for the 10th which consistently fails. This operation was completing successfully using Hibernate 3.6.x but since I've upgraded to Hibernate 5.4.x the operation no longer completes successfully.
After enabling DEBUG logging I can see that the transaction is still active and that the TransactionManager found the EntityManager for the JPA transaction. The Transaction was found to be active and the operation is going to participate in the existing transaction. But when the 10th delete operation is encountered the TransactionManger shows that were was a failure participating in the existing transaction and the transaction is then marked for rollback.
I'm unable to determine what is causing the failure.
Has anyone encountered something like this previously?
Log file below.
2019-03-22 09:00:32,692 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,692 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,725 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,725 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,735 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,736 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,736 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,736 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,266 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - /* DELETE FROM DObjReference AS o WHERE o.instanceId = :instanceId AND o.referencingObjectType = :referencingObjectType AND o. referencingObjectKey = :referencingObjectKey AND o.referencingParentKey = :referencingParentKey / delete from d_obj_reference where instance_id=? and referencing_object_type=? and referencing_object_key=? and referencing_parent_key=?
2019-03-22 09:00:33,278 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,278 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,283 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - / SELECT attributeKey FROM Attribute AS o WHERE o.instanceId = :instanceId / select attrib0_.attribute_key as col_0_0_ from attribute attrib0_ where attrib0_.instance_id=?
2019-03-22 09:00:33,295 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,295 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,323 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,323 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:34,133 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - / DELETE FROM DObjReference AS o WHERE o.instanceId = :instanceId AND o.referencingObjectType = :referencingObjectType AND o. referencingObjectKey = :referencingObjectKey AND o.referencingParentKey = :referencingParentKey / delete from d_obj_reference where instance_id=? and referencing_object_type=? and referencing_object_key=? and referencing_parent_key=?
2019-03-22 09:00:34,145 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:34,145 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:34,150 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - / SELECT attributeKey FROM Attribute AS o WHERE o.instanceId = :instanceId */ select attrib0_.attribute_key as col_0_0_ from attribute attrib0_ where attrib0_.instance_id=?
2019-03-22 09:00:34,226 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Initiating transaction commit
2019-03-22 09:00:34,226 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Committing JPA transaction on EntityManager [SessionImpl(1808876088)]
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:05:46,949 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating transaction failed - marking existing transaction as rollback-only
2019-03-22 09:05:46,950 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Setting JPA transaction on EntityManager [SessionImpl(1808876088)] rollback-only
2019-03-22 09:05:46,952 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating transaction failed - marking existing transaction as rollback-only
2019-03-22 09:05:46,953 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Setting JPA transaction on EntityManager [SessionImpl(1808876088)] rollback-only
2019-03-22 09:05:53,089 [main sessionId: vaultId: userId: origReqUri:] ERROR domain.impl.ObjectRepositoryImpl - [INFO - General] - Exception caught while executing observer. Since this is post-commit, it will be skipped!
org.springframework.dao.InvalidDataAccessApiUsageException: Executing an update/delete query; nested exception is javax.persistence.TransactionRequiredException: Executing an update/delete query
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:413)
at org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect.ajc$afterThrowing$org_springframework_orm_jpa_aspectj_JpaExceptionTranslatorAspect$1$18a1ac9(JpaExceptionTranslatorAspect.aj:37)
spring hibernate spring-transactions
add a comment |
I am running within the context of an afterTransactionCommit. I have a method, which is marked as @Transactional(propagation = REQUIRED). The method is using a JPA EntityManager to perform the delete operation, which is delegating to Hibernate 5 running within a Spring 4.3 container. There are more the 10 operations being executed in the afterTransactionCommit. Each delete completes successfully except for the 10th which consistently fails. This operation was completing successfully using Hibernate 3.6.x but since I've upgraded to Hibernate 5.4.x the operation no longer completes successfully.
After enabling DEBUG logging I can see that the transaction is still active and that the TransactionManager found the EntityManager for the JPA transaction. The Transaction was found to be active and the operation is going to participate in the existing transaction. But when the 10th delete operation is encountered the TransactionManger shows that were was a failure participating in the existing transaction and the transaction is then marked for rollback.
I'm unable to determine what is causing the failure.
Has anyone encountered something like this previously?
Log file below.
2019-03-22 09:00:32,692 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,692 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,725 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,725 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,735 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,736 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,736 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,736 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,266 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - /* DELETE FROM DObjReference AS o WHERE o.instanceId = :instanceId AND o.referencingObjectType = :referencingObjectType AND o. referencingObjectKey = :referencingObjectKey AND o.referencingParentKey = :referencingParentKey / delete from d_obj_reference where instance_id=? and referencing_object_type=? and referencing_object_key=? and referencing_parent_key=?
2019-03-22 09:00:33,278 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,278 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,283 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - / SELECT attributeKey FROM Attribute AS o WHERE o.instanceId = :instanceId / select attrib0_.attribute_key as col_0_0_ from attribute attrib0_ where attrib0_.instance_id=?
2019-03-22 09:00:33,295 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,295 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,323 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,323 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:34,133 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - / DELETE FROM DObjReference AS o WHERE o.instanceId = :instanceId AND o.referencingObjectType = :referencingObjectType AND o. referencingObjectKey = :referencingObjectKey AND o.referencingParentKey = :referencingParentKey / delete from d_obj_reference where instance_id=? and referencing_object_type=? and referencing_object_key=? and referencing_parent_key=?
2019-03-22 09:00:34,145 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:34,145 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:34,150 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - / SELECT attributeKey FROM Attribute AS o WHERE o.instanceId = :instanceId */ select attrib0_.attribute_key as col_0_0_ from attribute attrib0_ where attrib0_.instance_id=?
2019-03-22 09:00:34,226 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Initiating transaction commit
2019-03-22 09:00:34,226 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Committing JPA transaction on EntityManager [SessionImpl(1808876088)]
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:05:46,949 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating transaction failed - marking existing transaction as rollback-only
2019-03-22 09:05:46,950 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Setting JPA transaction on EntityManager [SessionImpl(1808876088)] rollback-only
2019-03-22 09:05:46,952 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating transaction failed - marking existing transaction as rollback-only
2019-03-22 09:05:46,953 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Setting JPA transaction on EntityManager [SessionImpl(1808876088)] rollback-only
2019-03-22 09:05:53,089 [main sessionId: vaultId: userId: origReqUri:] ERROR domain.impl.ObjectRepositoryImpl - [INFO - General] - Exception caught while executing observer. Since this is post-commit, it will be skipped!
org.springframework.dao.InvalidDataAccessApiUsageException: Executing an update/delete query; nested exception is javax.persistence.TransactionRequiredException: Executing an update/delete query
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:413)
at org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect.ajc$afterThrowing$org_springframework_orm_jpa_aspectj_JpaExceptionTranslatorAspect$1$18a1ac9(JpaExceptionTranslatorAspect.aj:37)
spring hibernate spring-transactions
I am running within the context of an afterTransactionCommit. I have a method, which is marked as @Transactional(propagation = REQUIRED). The method is using a JPA EntityManager to perform the delete operation, which is delegating to Hibernate 5 running within a Spring 4.3 container. There are more the 10 operations being executed in the afterTransactionCommit. Each delete completes successfully except for the 10th which consistently fails. This operation was completing successfully using Hibernate 3.6.x but since I've upgraded to Hibernate 5.4.x the operation no longer completes successfully.
After enabling DEBUG logging I can see that the transaction is still active and that the TransactionManager found the EntityManager for the JPA transaction. The Transaction was found to be active and the operation is going to participate in the existing transaction. But when the 10th delete operation is encountered the TransactionManger shows that were was a failure participating in the existing transaction and the transaction is then marked for rollback.
I'm unable to determine what is causing the failure.
Has anyone encountered something like this previously?
Log file below.
2019-03-22 09:00:32,692 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,692 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,725 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,725 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,735 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,736 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,736 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,736 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:32,738 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,266 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - /* DELETE FROM DObjReference AS o WHERE o.instanceId = :instanceId AND o.referencingObjectType = :referencingObjectType AND o. referencingObjectKey = :referencingObjectKey AND o.referencingParentKey = :referencingParentKey / delete from d_obj_reference where instance_id=? and referencing_object_type=? and referencing_object_key=? and referencing_parent_key=?
2019-03-22 09:00:33,278 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,278 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,283 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - / SELECT attributeKey FROM Attribute AS o WHERE o.instanceId = :instanceId / select attrib0_.attribute_key as col_0_0_ from attribute attrib0_ where attrib0_.instance_id=?
2019-03-22 09:00:33,295 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,295 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,323 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,323 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,332 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:33,334 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:34,133 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - / DELETE FROM DObjReference AS o WHERE o.instanceId = :instanceId AND o.referencingObjectType = :referencingObjectType AND o. referencingObjectKey = :referencingObjectKey AND o.referencingParentKey = :referencingParentKey / delete from d_obj_reference where instance_id=? and referencing_object_type=? and referencing_object_key=? and referencing_parent_key=?
2019-03-22 09:00:34,145 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:34,145 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:34,150 [main sessionId: vaultId: userId: origReqUri:] DEBUG org.hibernate.SQL - / SELECT attributeKey FROM Attribute AS o WHERE o.instanceId = :instanceId */ select attrib0_.attribute_key as col_0_0_ from attribute attrib0_ where attrib0_.instance_id=?
2019-03-22 09:00:34,226 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Initiating transaction commit
2019-03-22 09:00:34,226 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Committing JPA transaction on EntityManager [SessionImpl(1808876088)]
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Found thread-bound EntityManager [SessionImpl(1808876088)] for JPA transaction
2019-03-22 09:00:34,294 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating in existing transaction
2019-03-22 09:05:46,949 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating transaction failed - marking existing transaction as rollback-only
2019-03-22 09:05:46,950 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Setting JPA transaction on EntityManager [SessionImpl(1808876088)] rollback-only
2019-03-22 09:05:46,952 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Participating transaction failed - marking existing transaction as rollback-only
2019-03-22 09:05:46,953 [main sessionId: vaultId: userId: origReqUri:] DEBUG common.infrastructure.TransactionManager - Setting JPA transaction on EntityManager [SessionImpl(1808876088)] rollback-only
2019-03-22 09:05:53,089 [main sessionId: vaultId: userId: origReqUri:] ERROR domain.impl.ObjectRepositoryImpl - [INFO - General] - Exception caught while executing observer. Since this is post-commit, it will be skipped!
org.springframework.dao.InvalidDataAccessApiUsageException: Executing an update/delete query; nested exception is javax.persistence.TransactionRequiredException: Executing an update/delete query
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:413)
at org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect.ajc$afterThrowing$org_springframework_orm_jpa_aspectj_JpaExceptionTranslatorAspect$1$18a1ac9(JpaExceptionTranslatorAspect.aj:37)
spring hibernate spring-transactions
spring hibernate spring-transactions
asked Mar 22 at 16:32
C. MathrusseC. Mathrusse
335
335
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55304033%2fdelete-operation-in-aftertrasnactioncommit-raises-exception%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55304033%2fdelete-operation-in-aftertrasnactioncommit-raises-exception%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown