[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2272?page=all ]
Markus Heiden updated HHH-2272:
-------------------------------
Attachment: hack.patch
Here is my hack for fixing this issue. It is a patch against the src folder of hibernate
3.2.0 ga. This patch is currently just implemented for the save-update cascade, but may be
(should be?) applied to other cascading actions too. It includes the hack which fixes
HHH-1612.
I wasn't able to get all tests running without failure on the unpatched hibernate
source, so I cannot promise that this patch won't break any tests. I am not enough in
hibernate to promise that the new cache in StatefulPersistenceContext won't produce
any memory leaks.
I hope you check this patch soon, rework it and release it with the next minor release
:-)
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
Type: Task
Components: core
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