Greetings,
I am using Hibernate 2 to insert a large number of Objects in to a database. I know the standard answer is that ORM tools are less suitable for this type of task but that's what I'm trying to do anyway. 8)
I read this in the FAQ:
http://blog.hibernate.org/cgi-bin/blosx ... 8/26#batch
Here Gavin suggests changing the batch size and calling flush() and clear() on the Session regularly.
In my case I have done both.
However, running a profiler reveals that in the SessionImpl class there is a field named "executions" (ArrayList) which is holding references to my Objects. I looked at the hibernate source and it seems that the executions is only cleared after a transaction is complete.
The result is the executions ArrayList grows holding Objects that should have already been flushed until the application goes out of memory.
Looking over the forums I have found similar messages such as:
http://forum.hibernate.org/viewtopic.ph ... executions
http://forum.hibernate.org/viewtopic.ph ... executions
http://forum.hibernate.org/viewtopic.ph ... executions
One poster suggested that 2.1.7 resolved this but I tried it with 2.1.7 (was using 2.1.3) and the problem still exists.
I also understand that if you commit the transaction periodically it will clear the executions ArrayList however that does not fit my particular use case.
Does anyone know if this is a bug and if there is a workaround?
Thank you for your time.
Derek