Hibernate 错误HHH-7478已被 hibernate 社区标记为已关闭,并且自 4.2.1 以来已得到解决。我目前在 4.2.5 中,当我尝试复制相同的用例时,如所附票证中所述。我可以重现这个错误。
我无法在 Hibernate 网站上注册以评论尚未修复的错误。在我这样做之前,我想确认我是否做错了什么;
我的课;
public class OOPostUpdateEventListener implements PostUpdateEventListener, EnversListener {
public void onPostUpdate(PostUpdateEvent event) {
...do something
System.out.println(" Registering BeforeTransactionCompletionProcess ");
event.getSession().getActionQueue().registerProcess(new BeforeTransactionCompletionProcess() {
@Override
public void doBeforeTransactionCompletion(SessionImplementor session) {
System.out.println("BeforeTransactionCompletionProcess");
}
});
System.out.println(" Registering AfterTransactionCompletionProcess ");
event.getSession().getActionQueue().registerProcess(new AfterTransactionCompletionProcess() {
@Override
public void doAfterTransactionCompletion(boolean success, SessionImplementor session) {
System.out.println("AfterTransactionCompletionProcess");
}
});
}
}
日志看起来像这样;
-- Registering BeforeTransactionCompletionProcess
-- Registering AfterTransactionCompletionProcess
-- Exception;
ArrayList$Itr.checkForComodification() line: 819
ArrayList$Itr.next() line: 791
ActionQueue.executeActions(List) line: 368
ActionQueue.executeActions() line: 287
DefaultFlushEventListener(AbstractFlushingEventListener).performExecutions(EventSource) line: 339
DefaultFlushEventListener.onFlush(FlushEvent) line: 52
SessionImpl.flush() line: 1234
SessionImpl.managedFlush() line: 404
JdbcTransaction.beforeTransactionCommit() line: 101
JdbcTransaction(AbstractTransactionImpl).commit() line: 175
HibernateTransactionManager.doCommit(DefaultTransactionStatus) line: 554
HibernateTransactionManager(AbstractPlatformTransactionManager).processCommit(DefaultTransactionStatus) line: 755
HibernateTransactionManager(AbstractPlatformTransactionManager).commit(TransactionStatus) line: 724
TransactionInterceptor(TransactionAspectSupport).commitTransactionAfterReturning(TransactionAspectSupport$TransactionInfo) line: 475 TransactionInterceptor(TransactionAspectSupport).invokeWithinTransaction(Method, Class, TransactionAspectSupport$InvocationCallback) line: 270
TransactionInterceptor.invoke(MethodInvocation) line: 94
-- AfterTransactionCompletionProcess
我所做的有什么问题吗?还是bug没有修复?
编辑:该错误适用于 PostInsert,我的代码与 PostUpdate 相关