Sign In : Sign Up : Blog : Search: Language : Help :
This website is now frozen, please migrate your content to BotLibre.com or BotLibre.biz
Java Persistence Performance : Bulk inserts cause OOM even if done in batches

RE: Bulk inserts cause OOM even if done in batches

by pranahata posted Dec 13 2014, 21:14


Thank you for your help.

It turned out to be a a really interesting problem.

We had a detached entity called Locality.

As part of the transactions we were doing something like:


It turns out to be that whenever we invoked this method, theDetachedLocality entity keep a reference to the xxxEntity in its ChangeTracking attributes (added to locality via change weaving), therefore all our xxxEntity objects (1 Million) stayed in memory.

The funny thing is that xxxEntity.locality was a uni directional @ManyToOne so i had never thought that by doing xxxEntity.setLocality(theDetachedLocality) any of the ChangeTracking attributes of theDetachedLocality would ever keep track of changes on the xxxEntity but it dead

we found it analyzing a heap dump

Just out of interest, do you know why EL does this?

Thanks again for your help.

Id: 326730
Posted: Dec 13 2014, 21:14
Updated: Dec 13 2014, 21:18
Replies: 0
Views: 1659, today: 3, week: 10, month: 24
I'm sure
Flag graphic as offensive, or in violation of site rules