hibernate的top vote bug被我遇到了
(lazy) m:n relation + EventListener = AssertionFailure: collection [n-side] was not processed by flush()
链接:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2763
hibernate的event系统和它原有的机制有点区别.....如果想通过preUpdate or PostUpdate去修改原先的值,还是不要了,因为这样lazy就不能用了.....
这哥们总结的好:
My conclusion was, that you have not to change the state of the current object in the current session within events.
But if you want only use changed attributes - use the findDirty() (ore something called like this)(实际上是getOldState()) to touch only changed (and loaded) attributes.