There are straightforward workarounds....
Simon Spero wrote:
[Hibernate2, seen in 2.1.5 and HEAD] I've hit a problem involving cascades and delayed insertions that is pretty annoying, and looks awkward to fix properly in h2.
The problem can be seen if you create a parent object with a non identity id (e.g. assigned), and which has a cascaded child with a generated id.
When the parent is initially saved, the child gets saved, and its ID column gets set correctly. The parent itself is not forced; instead a scheduled insertion is created and added to the insertions queue.
If the parent is changed before the insertion is forced, the scheduled insertion can behave rather bizzarely.
Persister.insert will be called with the old state (not incorrect, but wasteful).
If the parent has a cache, a cache entry will be created with the current values of the object rather than those at the time the insertion was created; if the cascaded object has been replaced by a new object that hasn't been previously saved, the cache entry creation will fail, as the new value hasn't been through cascading yet.
If the parent does not have a cache, things blow up in executeBatch; I haven't finished tracking this down completely.
I'll post a smallish test case to JIRA after dinner.
Simon
------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel