Hibernate 6.2 could not execute certain delete statements

Hi,

We have an app which is running fine in WildFly 27, with hibernate 6.1.5. We upgraded to WildFly 28, which upgraded to hibernate 6.2.1, and we started to see this error:

2023-06-14 12:00:59,070 DEBUG Thread-63 [org.hibernate.engine.jdbc.spi.SqlStatementLogger] [logStatement] delete from TRUTH.FOLDER_FOLDER_LINK where FOLDER_ID=? and PARENT_FOLDER_ID=? and FOLDER_ID=? and PARENT_FOLDER_ID=? and LINK_TYPE_NAME=? and PARENT_FOLDER_ID=? and FOLDER_ID=?                                                   
2023-06-14 12:00:59,071 WARN Thread-63 [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] [logExceptions] SQL Error: 17041, SQLState: 99999
2023-06-14 12:00:59,071 ERROR Thread-63 [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] [logExceptions] Missing IN or OUT parameter at index:: 3
2023-06-14 12:00:59,073 WARNING Thread-63 [com.opsware._gen.sejb.folder._FolderServiceBean] [_opsw__bulkRemove] Unexpected exception thrown
org.hibernate.exception.GenericJDBCException: could not execute statement [Missing IN or OUT parameter at index:: 3] [delete from TRUTH.FOLDER_FOLDER_LINK where FOLDER_ID=? and PARENT_FOLDER_ID=? and FOLDER_ID=? and PARENT_FOLDER_ID=? and LINK_TYPE_NAME=? and PARENT_FOLDER_ID=? and FOLDER_ID=?]                                 
        at org.hibernate@6.2.1.Final//org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:61)
        at org.hibernate@6.2.1.Final//org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:108)
        at org.hibernate@6.2.1.Final//org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:278)
        at org.hibernate@6.2.1.Final//org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.performNonBatchedMutation(AbstractMutationExecutor.java:108)
        at org.hibernate@6.2.1.Final//org.hibernate.engine.jdbc.mutation.internal.MutationExecutorSingleNonBatched.performNonBatchedOperations(MutationExecutorSingleNonBatched.java:40)
        at org.hibernate@6.2.1.Final//org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.execute(AbstractMutationExecutor.java:53)
        at org.hibernate@6.2.1.Final//org.hibernate.persister.entity.mutation.DeleteCoordinator.doDynamicDelete(DeleteCoordinator.java:112)
        at org.hibernate@6.2.1.Final//org.hibernate.persister.entity.mutation.DeleteCoordinator.coordinateDelete(DeleteCoordinator.java:83)
        at org.hibernate@6.2.1.Final//org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2762)
        at org.hibernate@6.2.1.Final//org.hibernate.action.internal.EntityDeleteAction.execute(EntityDeleteAction.java:131)
        at org.hibernate@6.2.1.Final//org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:616)
        at org.hibernate@6.2.1.Final//org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:487)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
        at org.hibernate@6.2.1.Final//org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:484)
        at org.hibernate@6.2.1.Final//org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:358)
        at org.hibernate@6.2.1.Final//org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
        at org.hibernate@6.2.1.Final//org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127)
        at org.hibernate@6.2.1.Final//org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1412)
        at org.hibernate@6.2.1.Final//org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1398)
        at org.jboss.as.jpa@28.0.1.Final//org.jboss.as.jpa.container.AbstractEntityManager.flush(AbstractEntityManager.java:462)
        at com.hp.sa.twist//com.opsware.twist.jpa.JPAUtil.flushAfterMethod(JPAUtil.java:165)
        at com.hp.sa.twist//com.opsware.twist.jpa.JPAUtil.flushAfterRemove(JPAUtil.java:186)
        at com.hp.sa.twist//com.opsware.twist.jpa.BaseEntityBean.removeAll(BaseEntityBean.java:153)
        at com.hp.sa.twist//com.opsware.twist.jpa.BaseEntityBean.cascadeRemove(BaseEntityBean.java:104)
        at com.hp.sa.shared.entity//com.opsware.shared.ejb.entity._Folder.ejbRemove(_Folder.java:1182)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.hibernate@6.2.1.Final//org.hibernate.jpa.event.internal.EntityCallback.performCallback(EntityCallback.java:50)
        at org.hibernate@6.2.1.Final//org.hibernate.jpa.event.internal.CallbackRegistryImpl.callback(CallbackRegistryImpl.java:113)
        at org.hibernate@6.2.1.Final//org.hibernate.jpa.event.internal.CallbackRegistryImpl.preRemove(CallbackRegistryImpl.java:86)
        at org.hibernate@6.2.1.Final//org.hibernate.event.internal.DefaultDeleteEventListener.delete(DefaultDeleteEventListener.java:240)
        at org.hibernate@6.2.1.Final//org.hibernate.event.internal.DefaultDeleteEventListener.deletePersistentInstance(DefaultDeleteEventListener.java:219)
        at org.hibernate@6.2.1.Final//org.hibernate.event.internal.DefaultDeleteEventListener.delete(DefaultDeleteEventListener.java:159)
        at org.hibernate@6.2.1.Final//org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:95)
        at org.hibernate@6.2.1.Final//org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:83)
        at org.hibernate@6.2.1.Final//org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127)
        at org.hibernate@6.2.1.Final//org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:961)
        at org.hibernate@6.2.1.Final//org.hibernate.internal.SessionImpl.delete(SessionImpl.java:892)
        at org.hibernate@6.2.1.Final//org.hibernate.internal.SessionImpl.remove(SessionImpl.java:2354)
        at org.jboss.as.jpa@28.0.1.Final//org.jboss.as.jpa.container.AbstractEntityManager.remove(AbstractEntityManager.java:658)
        at com.hp.sa.twist//com.opsware.twist.jpa.BaseEntityBean.remove(BaseEntityBean.java:50)
        at deployment.main.ear.shared-session.jar//com.opsware.folder.FolderPersistence.remove(FolderPersistence.java:233)
        at deployment.main.ear.shared-session.jar//com.opsware.shared.folder.FolderImpl.remove(FolderImpl.java:1584)
        at deployment.main.ear.shared-session.jar//com.opsware.shared.folder.FolderImpl.remove(FolderImpl.java:1493)
        at deployment.main.ear.shared-session.jar//com.opsware.shared.folder.FolderImpl.bulkRemove(FolderImpl.java:1667)
        at deployment.main.ear.shared-session.jar//com.opsware.folder.ejb.session.FolderServiceBean.bulkRemove(FolderServiceBean.java:347) 
        at deployment.main.ear.shared-session.jar//com.opsware._gen.sejb.folder._FolderServiceBean._opsw__bulkRemove(_FolderServiceBean.java:2392) 
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                  
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)                                                                                                          
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)                                                                              
        at org.jboss.as.ee@28.0.1.Final//org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)               
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)  
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)                                                               
        at org.jboss.as.jpa@28.0.1.Final//org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)   
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)                  
        at org.jboss.as.ee@28.0.1.Final//org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)             
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:40)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:53)
        at org.jboss.as.ee@28.0.1.Final//org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)              
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:56)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:254)
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:390)            
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:160)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:47)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.security.IdentityOutflowInterceptor.processInvocation(IdentityOutflowInterceptor.java:73)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.security.SecurityDomainInterceptor.processInvocation(SecurityDomainInterceptor.java:44)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)    
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.deployment.processors.StartupAwaitInterceptor.processInvocation(StartupAwaitInterceptor.java:22)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)          
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)                                  
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:67)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)                 
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.component.interceptors.EjbExceptionTransformingInterceptorFactories$1.processInvocation(EjbExceptionTransformingInterceptorFactories.java:81)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)                                 
        at org.jboss.as.ee@28.0.1.Final//org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:60)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)        
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:438)
        at org.wildfly.security.elytron-base@2.1.0.Final//org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:633)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:57)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
        at org.jboss.invocation@2.0.0.Final//org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:53)
        at org.jboss.as.ee@28.0.1.Final//org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:198)                           
        at org.wildfly.security.elytron-base@2.1.0.Final//org.wildfly.security.auth.server.SecurityIdentity.runAsFunctionEx(SecurityIdentity.java:421)
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.remote.AssociationImpl.invokeWithIdentity(AssociationImpl.java:654)           
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.remote.AssociationImpl.invokeMethod(AssociationImpl.java:632)                                                                                           
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.remote.AssociationImpl.lambda$receiveInvocationRequest$0(AssociationImpl.java:230)
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.remote.AssociationImpl.execute(AssociationImpl.java:321)                              
        at org.jboss.as.ejb3@28.0.1.Final//org.jboss.as.ejb3.remote.AssociationImpl.receiveInvocationRequest(AssociationImpl.java:274)                           
        at org.jboss.ejb-client@5.0.4.Final//org.jboss.ejb.protocol.remote.EJBServerChannel$ReceiverImpl.handleInvocationRequest(EJBServerChannel.java:477)
        at org.jboss.ejb-client@5.0.4.Final//org.jboss.ejb.protocol.remote.EJBServerChannel$ReceiverImpl.handleMessage(EJBServerChannel.java:212)                      
        at org.jboss.remoting@5.0.27.Final//org.jboss.remoting3.remote.RemoteConnectionChannel.lambda$handleMessageData$3(RemoteConnectionChannel.java:432)                             
        at org.jboss.remoting@5.0.27.Final//org.jboss.remoting3.EndpointImpl$TrackingExecutor.lambda$execute$0(EndpointImpl.java:993)               
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) 
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)                              
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377) 
        at org.jboss.xnio@3.8.9.Final//org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)             
        at java.base/java.lang.Thread.run(Thread.java:829)                                                                        
Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 3                                                                                              
        at com.oracle.ojdbc@19.12.0.0.0//oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1937)
        at com.oracle.ojdbc@19.12.0.0.0//oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3657)                    
        at com.oracle.ojdbc@19.12.0.0.0//oracle.jdbc.driver.T4CPreparedStatement.executeInternal(T4CPreparedStatement.java:1426)       
        at com.oracle.ojdbc@19.12.0.0.0//oracle.jdbc.driver.OraclePreparedStatement.executeLargeUpdate(OraclePreparedStatement.java:3756)                           
        at com.oracle.ojdbc@19.12.0.0.0//oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3736)
        at com.oracle.ojdbc@19.12.0.0.0//oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1063)
        at org.jboss.ironjacamar.jdbcadapters@3.0.2.Final//org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:537)
        at org.hibernate@6.2.1.Final//org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:275)
        ... 113 more  

Checking the hibernate generated SQL in 6.1.5, reveals they are different:

2023-06-12 13:47:14,545 DEBUG Thread-163 [org.hibernate.engine.jdbc.spi.SqlStatementLogger] [logStatement] delete from TRUTH.FOLDER_FOLDER_LINK where FOLDER_ID=? and PARENT_FOLDER_ID=? and FOLDER_ID = ? and PARENT_FOLDER_ID = ? and LINK_TYPE_NAME = ?

I tried to debug the issue, and from my understanding hibernate generates a delete SQL statement, but when it comes to binding the input parameters, hibernate doesn’t bind all of them, resulting in the above error.
I’ve noticed some extensive work in hibernate 6.2 related to how the SQL is generated: HHH-15393 - Improve write-paths to use mapping model by sebersole · Pull Request #5620 · hibernate/hibernate-orm · GitHub. Maybe there is a regression in this area?

Snippets of the involved entities:

@Entity
@OptimisticLocking(type = OptimisticLockType.DIRTY)
@DynamicUpdate
@Cacheable
@org.hibernate.annotations.Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL, region = "shared")
@Table(name = "FOLDER", schema = "TRUTH")
public class Folder extends _Folder {}

@MappedSuperclass
@Access(AccessType.FIELD)
@CollectionRoles(roles ={
"com.opsware.shared.ejb.entity.Folder.children",
"com.opsware.shared.ejb.entity.Folder.folder",
"com.opsware.shared.ejb.entity.Folder.folderLink",
})
abstract public class _Folder {

    @OneToMany(targetEntity = FolderFolderLink.class, mappedBy= "realFolder")
    @org.hibernate.annotations.CollectionType(type=com.opsware.twist.jpa.PersistentSetType.class)
    @org.hibernate.annotations.Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL, region="shared_collections")
    final java.util.Set folderLink = new HashSet();
}

@Entity
@OptimisticLocking(type = OptimisticLockType.DIRTY)
@DynamicUpdate
@Cacheable
@org.hibernate.annotations.Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL, region = "shared")
@Table(name = "FOLDER_FOLDER_LINK", schema = "TRUTH")
public class FolderFolderLink extends _FolderFolderLink {}

@MappedSuperclass
@Access(AccessType.FIELD)
@IdClass(FolderFolderLinkPK.class)
abstract public class _FolderFolderLink {

    @Id
    @Column(name="FOLDER_ID")
    Long folderId;

    @OptimisticLock(excluded = true)
    @Column(name="LINK_TYPE_NAME", insertable = false, updatable = false)
    String linkTypeName;

    @Id
    @Column(name="PARENT_FOLDER_ID")
    Long parentFolderId;

    // CMR methods
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "LINK_TYPE_NAME")
    LinkType linkType;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PARENT_FOLDER_ID", insertable = false, updatable = false)
    Folder parent;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "FOLDER_ID", insertable = false, updatable = false)
    Folder realFolder;
}

You should update to Hibernate 6.2.5.Final

With Hibernate 6.2.5, the generated SQL is a bit different, but the problem persists

org.hibernate.exception.GenericJDBCException: could not execute statement [Missing IN or OUT parameter at index:: 4] [delete from TRUTH.FOLDER_FOLDER_LINK where FOLDER_ID=? and PARENT_FOLDER_ID=? and FOLDER_ID is
null and PARENT_FOLDER_ID is null and LINK_TYPE_NAME=? and PARENT_FOLDER_ID=? and FOLDER_ID=?]                                                                                                                      
        at org.hibernate@6.2.5.Final//org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:61)                                                                 
        at org.hibernate@6.2.5.Final//org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:108)                                                                                         
        at org.hibernate@6.2.5.Final//org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:278)                                                                            
        at org.hibernate@6.2.5.Final//org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.performNonBatchedMutation(AbstractMutationExecutor.java:108)                                             
        at org.hibernate@6.2.5.Final//org.hibernate.engine.jdbc.mutation.internal.MutationExecutorSingleNonBatched.performNonBatchedOperations(MutationExecutorSingleNonBatched.java:40)                            
        at org.hibernate@6.2.5.Final//org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.execute(AbstractMutationExecutor.java:53)    
        at org.hibernate@6.2.5.Final//org.hibernate.persister.entity.mutation.DeleteCoordinator.doDynamicDelete(DeleteCoordinator.java:113)    
        at org.hibernate@6.2.5.Final//org.hibernate.persister.entity.mutation.DeleteCoordinator.coordinateDelete(DeleteCoordinator.java:84)
        at org.hibernate@6.2.5.Final//org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2867)                                                                              
        at org.hibernate@6.2.5.Final//org.hibernate.action.internal.EntityDeleteAction.execute(EntityDeleteAction.java:131)                                
        at org.hibernate@6.2.5.Final//org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:606)                                                                                                     
        at org.hibernate@6.2.5.Final//org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:475)                                                                                                     
        at org.hibernate@6.2.5.Final//org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:358)                                                          
        at org.hibernate@6.2.5.Final//org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)                                                                             
        at org.hibernate@6.2.5.Final//org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127)                                                          
        at org.hibernate@6.2.5.Final//org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1412)                                                                                                             
        at org.hibernate@6.2.5.Final//org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1398)                                             
        at org.jboss.as.jpa@28.0.1.Final//org.jboss.as.jpa.container.AbstractEntityManager.flush(AbstractEntityManager.java:462)                                                                                    
        at com.hp.sa.twist//com.opsware.twist.jpa.JPAUtil.flushAfterMethod(JPAUtil.java:165)                                                                                                                        
        at com.hp.sa.twist//com.opsware.twist.jpa.JPAUtil.flushAfterRemove(JPAUtil.java:186)                                                                                                                         
        at com.hp.sa.twist//com.opsware.twist.jpa.BaseEntityBean.removeAll(BaseEntityBean.java:153)      

Thanks for checking. In that case, please create an issue in the issue tracker(https://hibernate.atlassian.net) with a test case(hibernate-test-case-templates/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java at main · hibernate/hibernate-test-case-templates · GitHub) that reproduces the issue.

Created issue with reproducer: https://hibernate.atlassian.net/browse/HHH-16816

1 Like