I think I have discovered a bug in hibernate 3.6.10, but am having trouble creating a test case. I describe the bug here:
https://hibernate.onjira.com/browse/HHH-7920
To replicate it, I need to setup two entities with a bidirectional OneToMany(cascade=CascadeType.ALL, mappedBy=)/ManyToOne relationship.
Next I need to save the Parent entity (on the one side) without any children.
Finally I need to retrieve the Parent entity from the database, so that it's children collection is actually a PersistentBag under the hood.
Once this stage is set, the following steps reproduce the bug:
Code:
parent.children.add(new Child()); //write is queued because !initialized && isConnectedToSession() && isInverseCollection()
parent.children.size(); //triggers PersistentBag::read(), which triggers an initialize()
//AT THIS POINT THE BUG HAS TECHNICALLY OCCURRED.. my transient entity (which was queued for write) has been added to the snapshot that is supposed to represent the collection before any changes.
//now call flush() or anything that will eventually call children.getOrphans(). Exception will result
I'm sorry to be such a helpless noob... I've been using hibernate for a few years now and would love to give back. Any pointers you guys could give me about building a valid test case would be great.
Thanks again,
-John