Issue Type: Bug Bug
Affects Versions: 4.1.9, 4.1.8
Assignee: Unassigned
Created: 05/Feb/13 3:40 PM
Description:

This worked fine in Hibernate-4.1.7 but stopped working in 4.1.8

Iterating over a collection in an Entity outside the transaction (persistence-context) makes org.hibernate.engine.internal.Collections.prepareCollectionForUpdate() think that ownerChanged == true, which results in:

// Collections:252 in Hibernate-4.1.9.Final
entry.setDoremove( true );

This means that Hibernate will silently clear collections and remove data if you access a collection outside the transaction with ENABLE_LAZY_LOAD_NO_TRANS enabled.

As if this is not bad enough, if you have a constraint in the DB preventing this delete, then this results in Hibernate leaking connections because ( ( Session) session ).getTransaction().commit() in AbstractPersistentCollection:241 throws an Exception, resulting in the connection not being closed on line 243.

Project: Hibernate ORM
Priority: Blocker Blocker
Reporter: Andreas Joseph Krogh
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira