]
Steve Ebersole closed HHH-2272.
-------------------------------
Resolution: Duplicate
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: Hibernate Core
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, Number of call.jpg, patchCascading.patch,
SaveTest.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: