[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2763?page=c...
]
j nadler commented on HHH-2763:
-------------------------------
Agreed Stevo - it's past time this gets resolved. Or they could just close the Jira
if they have no intention of ever resolving. It certainly sounds that way from some of
the commments made by Hibernate team members.
enerally the number of votes, watchers, comments, and workarounds on an issue like this
should be a red flag to the team that something is really wrong. If all these people are
simply confused about how to use Hibernate, why is that? Perhaps there's a damn good
reason we're all trying to do this...
Allow collection initialization during flush
--------------------------------------------
Key: HHH-2763
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2763
Project: Hibernate Core
Issue Type: Sub-task
Components: core
Affects Versions: 3.2.4.sp1, 3.2.5
Environment: Windows-XP, Jboss 4.2.1GA, Hibernate 3.2.4SP1, EJB3
Reporter: S.Schnabl
Assignee: Steve Ebersole
Fix For: 4.1.0
Attachments: bidirectional_many-to-many.gif, cdel_analyse.txt,
HHH-2763_standalone_testcases.zip, HibernateWorkaroundHH2763.java,
one-to-many_with_many_side_having_collections.gif, Testcase.zip
Time Spent: 1.45h
Remaining Estimate: 0h
For more details see the attached testcase. I'm sorry, but in the short of time i
only got a testcase for jboss-server 4.2. Please deploy the server.ear from
/release-directory and then call the /src/client/TestCaseClient.java.
[Summarized]
It seems, that touching a lazy (Persistent-)Collection of at least a m:n relation inside
a Hibernate event-listener always raises this error:
org.hibernate.AssertionFailure: collection [n-side] was not processed by flush()
[Explanation]
I have two entities A. and B. Both having a m:n relation between each other. Furthermore
there is an PostUpdateListener, which iterates onUpdate of entitiy through all properties
of updated entity.
[Testcase]
Both entities are linked with eachother (m:n). If i now do a simple update of a property
of entity A --> MyPostUpdateListener will be called, which iterates through every
property of the updated entity. In case of this property was a collection (= lazy
PersistentCollection of m:n relation), hibernate initializes the collection for further
work. I can now run through all objects of the collection, but after all work is done in
listener, I get the following exception from postFlush:
Caused by: org.hibernate.AssertionFailure: collection
[com.qualitype.testcase.server.ejb.entity.EntityB.entitiesOfA] was not processed by
flush()
at org.hibernate.engine.CollectionEntry.postFlush(CollectionEntry.java:205)
at
org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:333)
at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:28)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at
org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:515)
... 29 more
Attention: EntityB.entitiesOfA is the other-side collection of the m:n relation of the
updated EntityA.
We are using hibernate-event listener system for auditing-purposes, so you should
understand that touching every (element in the) collection is necessary for
audit-purposes.
Seems for me like a serious bug. Need this fixed asap ...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira