[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2272?page=c...
]
Markus Heiden commented on HHH-2272:
------------------------------------
The hack already describes a working solution, but has a bug cleaning up the newly
introduced map in the session. Because I had a lot of work recently and there were not
much interest regarding this issue, I still haven't found the time to upload the final
version. But I still have this on my plan. When there is a need for the patch now, I will
try to urge myself a bit to extract this patch as a diff to the current version 3.2.5.
The (corrected) patch works now for more than 6 months in a production system without any
failures and memory leaks.
Serious performance problems when saving large amount of transient
entities with collections of transient entities
------------------------------------------------------------------------------------------------------------------
Key: HHH-2272
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2272
Project: Hibernate3
Issue Type: Task
Components: core
Affects Versions: 3.2.0.ga
Environment: Hibernate 3.2.0 on Oracle 9.2
Reporter: Markus Heiden
Attachments: hack.patch, hibernate.zip
When saving many (e.g. 50000) transient entities with a collection of transient entities,
for each collection element the whole persistence context is searched (by
StatefulPersistenceContext#getIndexInOwner() and StatefulPersistenceContext#getOwnerId)
and its even searched twice when the collection is an indexed collection. This leads to an
enormous amount (> 1000000) of iterations over all entities and over all collection
elements of each entity. Especially when one saves only the same type of entities this
leads to times of hours(!) even on a fast machine before any insert statement is even
issued. This issue is related to HHH-1612, but fixing issue HHH-1612 won't resolve
this problem (I have explored this with a hack which fixes HHH-1612).
In my eyes there are two ways to solve this problem:
1) When cascading the save of a parent, the parent cascade can fill the persistence
context with information about its collection elements. E.g. before cascading the save to
a collection a parent can add a (child, parent) pair to a map in the persistence context
to avoid the above described iterations. Then a simple Map#get() would be sufficient in
most cases to get the parent.
2) When cascading, the parent has to be passed with the cascaded (e.g. saved) element.
But this is no good solution, because it affects some well known hibernate apis.
--
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