Hibernate bug HHH-7478已被hibernate社区标记为已关闭,自4.2.1以来已解决。我目前在4.2.5中,当我尝试复制相同的用例时,如附带的票证所述。我可以重现这个bug。
我无法在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
我所做的事情有问题吗?或者错误是不是修复了?
编辑:该错误适用于PostInsert,我的代码适用于PostUpdate