Never thought about that, but sounded interesting enough for me to test.

I tried to persist 10000 instances of small entity beans in a loop, in JVM with as little as 2MB of heap (-Xms2m -Xmx2m). Without flush(), it run out of heap space at around ~2500. instance. Flushing it at every 1000 instances, run the whole thing without a problem.

It seems that without flush() OpenJPA will store all the queued queries on the heap (as expected). Regular flush() will free space on heap and reduce the need for garbage collection.

So, my opinion would be to go for it.

-Ognjen

is_maximum wrote:
Hi

we have a DAO class includes save() update() delete() etc. each business
methods in our stateless classes may have a number of CRUD operations and
all occur through that DAO class.
Currently we don't use flush() method for each save() or update() so at the
end of the transaction (business method) everything will be flushed
automatically.
but in some business methods because of their logic we have to put a
for-loop to process maybe more than 500 records. in this case, each loop may
contains a number of CRUD operations. In my opinion, we need to flush every
for example 200 operations have been applied. how to manage this? do you
have any idea? is this opinion correct?

I appreciate if you share your expriences on this with me.



Reply via email to