[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5771?page=c...
]
Mauricio Hiroshi Nagaoka commented on HHH-5771:
-----------------------------------------------
I also came across this issue when trying to remove from a {{Bag}} mapped as
{{cascade="all,delete-orphan"}}, even when specifying
{{lazy="extra"}}.
Looking at the source code (Hibernate 3.5.1, in my case), it seems {{PersistentBag}}
doesn't honor the "laziness" specified on the collection mapping like
{{PersistentSet}} and {{PersistentList}} do.
@Dobes as a workaround, I would suggest you to use a {{<set
cascade="all,delete-orphan" lazy="extra">}} instead. The
shortcoming of this approach is that Hibernate needs to check for uniqueness when you add
to the {{Set}}. This is done by issuing a {{select 1 from...}} so it may not be *that*
expensive.
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira