[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5771) PersistentBag.remove() and removeAll() load the whole collection

Dobes Vandermeer (JIRA) noreply at atlassian.com
Thu Dec 2 14:03:16 EST 2010


PersistentBag.remove() and removeAll() load the whole collection
----------------------------------------------------------------

                 Key: HHH-5771
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5771
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.5.5
            Reporter: Dobes Vandermeer


When removing an entity from the database, it is a requirement in hibernate that you remove the entity from any persistent collections it is in so that you don't get errors about transient objects being referenced by a collection.

However, calling remove() on a persistent collection seems to load the whole collection into memory.

The use of very large (too big to load all at once) lazy collections is apparently not well supported in hibernate because it is difficult to use them without loading the whole collection into memory rather than load it incrementally.  Nevertheless, it is possible to request subsets of collections and having the ability to remove() without loading the lazy collection would be a bonus for those of us who do use large lazy collections that way.

Here is the offending code:

{code}
	public boolean remove(Object o) {
		initialize( true );
		if ( bag.remove( o ) ) {
			dirty();
			return true;
		}
		else {
			return false;
		}
	}
{/code}

-- 
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list