Issues
- ActionQueue.BeforeTransactionCompletionProcessQueue incorrectly throws AssertionFailure wrapping a JPA exception instead of propagatingHHH-13386
- IS NULL doesn't work on not-owning side of one-to-one relationshipHHH-13166Resolved issue: HHH-13166
- Hibernate ActionQueue.sort() removes entities from insertion batchesHHH-11920Resolved issue: HHH-11920
- Schema name with dash causes errors for Hibernate hbm2ddl.autoHHH-11855
- Form-feed (\f 0x0C) in generated SQL triggers exceptions in FirebirdHHH-11467Resolved issue: HHH-11467Mark Rotteveel
- Oracle Spatial Dialect non-string mode is unavailableHHH-11301Resolved issue: HHH-11301
- CLONE[HHH-8873] - @Where not supported for @MappedSuperClassHHH-11272Resolved issue: HHH-11272
- Session closed exception when using Envers in a JTA transactionHHH-11232Resolved issue: HHH-11232Andrea Boriero
- SessionImpl.refresh() throws IllegalArgumentException, "not an Entity" when using custom entity nameHHH-11217Resolved issue: HHH-11217Andrea Boriero
- 2nd level cache ignoring HINT_LOADGRAPHHHH-11192Resolved issue: HHH-11192
- Numeric type inference issuesHHH-11167Resolved issue: HHH-11167
- JPA CriteriaUpdate - NullLiteral causes IllegalArgumentException: Could not convert java type to Hibernate typeHHH-11159Resolved issue: HHH-11159Andrea Boriero
- Hibernate release 5.2.2 causes high CPU usage initializing metamodel and parsing queriesHHH-11129
- FieldMapping not working when using SqlResultSetMapping and second EnitytManager instanceHHH-11122Resolved issue: HHH-11122Former user
- LazyPropertyInitializer$1 cannot be cast to [B when calling Session.merge() on compile time enhanced composed entitiesHHH-11117Resolved issue: HHH-11117Vlad Mihalcea
- @CreationTimestamp doesn't works with @Column(nullable=false)HHH-11096Resolved issue: HHH-11096Vlad Mihalcea
- MySQL56SpatialDialect does not register geometry types causing Geometry types are not correctly deserializedHHH-11087Resolved issue: HHH-11087
- JPA join with treat causes QuerySyntaxException: Invalid pathHHH-11081Resolved issue: HHH-11081Andrea Boriero
- DiscriminatorsValue's in MySQL are send unescaped to the server causing inconsistent behaviour.HHH-11064Resolved issue: HHH-11064Former user
- Treat on type without subclasses renders null = nullHHH-11062
- Cannot count distinct on SQL Server on embedded idsHHH-11042Resolved issue: HHH-11042Christian Beikov
- Ingres Doesn't Support Global Temporary Tables properly!HHH-11035
- Cascaded merge of a Many-to-many link entity generates invalid INSERTHHH-11026
- Startup performance regression : schema update/validateHHH-11023Resolved issue: HHH-11023Andrea Boriero
- ConcurrentModificationException for unsynchronized ResourceRegistryStandardImpl.xref variableHHH-11022Resolved issue: HHH-11022
- NullPointerException when creating EntityManagerFactoryHHH-11021Resolved issue: HHH-11021
- calling EntityManager.unwrap(Session.class) to gain access to Hibernated Session in a Weld CDI environment results in ClassCastExceptionHHH-11020
- Cannot override generator with a generic generator via orm fileHHH-11018Resolved issue: HHH-11018
- Migrate Integration Guide to AsciiDoctorHHH-11017Resolved issue: HHH-11017Vlad Mihalcea
- Hibernate Schema Management Tool does not properly drop sequences for PostgresSQL 8.2+HHH-11016Resolved issue: HHH-11016Chris Cranford
- Switch to native identifier strategy even when using the new identifier generatorsHHH-11014
- The release task creates two documentation folders for UserGuideHHH-11013Resolved issue: HHH-11013Vlad Mihalcea
- Hibernate Spatial Geometry Not SerializableHHH-11012Resolved issue: HHH-11012Karel Maesen
- ORM >= 5.0.9 not picking up sequence name when hibernate.id.new_generator_mappings = falseHHH-11011Resolved issue: HHH-11011Vlad Mihalcea
- org.hibernate.AnnotationException: Unable to create unique key constraint - if column not foundHHH-11009Resolved issue: HHH-11009Chris Cranford
- Remove the necessity to manually map the IndexColumn/OrderColumn property in reference entity.HHH-11008
- ConstraintMode.NO_CONSTRAINT not working with @MapKeyJoinColumnHHH-11006Resolved issue: HHH-11006
- OneToMany generated incorrect SQL where MapKey is on superclass and using InheritanceType.JOINEDHHH-11005Resolved issue: HHH-11005
- Array types as @ElementCollection values not handledHHH-11004Resolved issue: HHH-11004Vlad Mihalcea
- java.lang.NullPointerException due to converterHHH-11003Resolved issue: HHH-11003
- Add documentation section about Filter and FilterDefHHH-11002Resolved issue: HHH-11002Vlad Mihalcea
- NullPointerException when using join with subselect in hbm mappingHHH-10998Resolved issue: HHH-10998Andrea Boriero
- The cleanupTestData utility has issues with link tablesHHH-10996Resolved issue: HHH-10996Vlad Mihalcea
- NPE when Lazy loading collection without transaction for bytecode enhanced entitieHHH-10993Resolved issue: HHH-10993Former user
- Wrong order parameter binding when filters are used in conjunction with component type parameters and subqueriesHHH-10991Resolved issue: HHH-10991Andrea Boriero
- Cannot save JTS geometry with SRID 3857 into SRID 3857 columnHHH-10987Resolved issue: HHH-10987Karel Maesen
- relation not flushed when collection created after persist with enhanced entitiesHHH-10986Resolved issue: HHH-10986Luis Barreiro
- ClassCastException when using enhanced entitiesHHH-10985Resolved issue: HHH-10985Luis Barreiro
- Have multiLoad not return (unflushed) DELETED entitiesHHH-10984Resolved issue: HHH-10984Steve Ebersole
- HBM 'properties' element not honouring multi-column constraintHHH-10982Resolved issue: HHH-10982
50 of 109
ActionQueue.BeforeTransactionCompletionProcessQueue incorrectly throws AssertionFailure wrapping a JPA exception instead of propagating
Description
Details
Assignee
UnassignedUnassignedReporter
Manuel Dominguez SarmientoManuel Dominguez SarmientoPriority
Major
Details
Details
Assignee
Unassigned
UnassignedReporter
Manuel Dominguez Sarmiento
Manuel Dominguez SarmientoPriority
Created May 1, 2019 at 2:04 PM
Updated December 4, 2019 at 4:45 PM
Activity
Show:
Manuel Dominguez SarmientoMay 1, 2019 at 2:05 PMEdited
This is a real stack trace we obtained when running into this issue:
org.hibernate.AssertionFailure: Unable to perform beforeTransactionCompletion callback
at org.hibernate.engine.spi.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:952)
at org.hibernate.engine.spi.ActionQueue.beforeTransactionCompletion(ActionQueue.java:521)
at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2452)
at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:473)
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:156)
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$100(JdbcResourceLocalTransactionCoordinatorImpl.java:38)
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:231)
at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:68)
at org.springframework.orm.hibernate5.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:625)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:746)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:714)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:533)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:304)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:69)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy158.save(Unknown Source)
at com.renxo.cms.integration.CustomerFactoryImpl.getCustomerForSubscriberNumberInternal(CustomerFactoryImpl.java:570)
at com.renxo.cms.integration.CustomerFactoryImpl.getCustomerForSubscriberNumber(CustomerFactoryImpl.java:212)
at com.renxo.cms.web.struts.action.customer.CustomerAction$BatchBlacklistTask.run(CustomerAction.java:649)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.persistence.PessimisticLockException: could not execute batch
at org.hibernate.internal.ExceptionConverterImpl.wrapLockException(ExceptionConverterImpl.java:249)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:103)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:157)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:164)
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1443)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1423)
at org.hibernate.envers.internal.synchronization.AuditProcess.doBeforeTransactionCompletion(AuditProcess.java:177)
at org.hibernate.envers.internal.synchronization.AuditProcessManager$1.doBeforeTransactionCompletion(AuditProcessManager.java:47)
at org.hibernate.engine.spi.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:946)
... 24 more
Caused by: org.hibernate.PessimisticLockException: could not execute batch
at com.renxo.cms.dao.hibernate.CustomOracleSQLExceptionConversionDelegate.convert(CustomOracleSQLExceptionConversionDelegate.java:105)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:128)
at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.doExecuteBatch(BatchingBatch.java:104)
at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.execute(AbstractBatchImpl.java:147)
at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.executeBatch(JdbcCoordinatorImpl.java:212)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:629)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:474)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:337)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1437)
... 28 more
Caused by: java.sql.BatchUpdateException: ORA-08177: can't serialize access for this transaction
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:12296)
at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:246)
at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java)
at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:118)
... 36 more
Since Hibernate 5.2.x native HibernateExceptions are in many cases automatically wrapped in JPA exceptions via AbstractSharedSessionContract#exceptionConverter though not consistently, see https://hibernate.atlassian.net/browse/HHH-12666#icft=HHH-12666
If a HibernateException is thrown in the commit phase, and it is converted to a JPA exception, the following code inActionQueue.BeforeTransactionCompletionProcessQueue does not expect a JPA exception, so it wraps the JPA exception in an AssertionFailure, which is clearly not the intended result:
public void beforeTransactionCompletion() { while ( !processes.isEmpty() ) { try { processes.poll().doBeforeTransactionCompletion( session ); } catch (HibernateException he) { throw he; } catch (Exception e) { throw new AssertionFailure( "Unable to perform beforeTransactionCompletion callback", e ); } } }
This causes any client code which may potentially be expecting to catch either JPA or HibernateExceptions in the commit phase to fail. The solution is propagating JPA exceptions just like HibernateExceptions.
Currently, the workaround is enabling hibernate.native_exception_handling_51_compliance as implemented by https://hibernate.atlassian.net/browse/HHH-12666#icft=HHH-12666 which anyway seems to be preferred overall, since the transition to JPA exception seems to be quite inconsistent, plus client code is still in most cases expecting HibernateExceptions instead of JPA exceptions (the Spring integration in particular deals only with HibernateExceptions in most places, even though some support for JPA exceptions thrown by Hibernate was added in the latest releases).