-
1. Re: Manual Flush outside of a conversation does not work
javacoryd Sep 18, 2008 3:25 PM (in response to accless)Manual flush should have no affect in this situation. Flushing the entity manager only triggers pending CRUD operations to be executed against the database. The newly created entities still exist in the entity manager.
In your situation you need to flush then clear the entity manager. Clearing the entity manager will fix the
out of memory
issue.Cory.
-
2. Re: Manual Flush outside of a conversation does not work
accless Sep 18, 2008 5:01 PM (in response to accless)yep, clearing cache via em.clear() is the solution for the memory lack.
But another disadvantage occured.
I have to refresh (reload!) some (actually a bunch of) entities after the clearing, as I need to wire them with my fresh created entity from the csv-file. The reload is
necessary otherwise i get anot attatched entity passed to persist
- Exception. First, i thought it would be possible to use merge for the detached entities after invoking this.em.clear(), but this raised another error:row was updated by another transaction
(i think the optimistic lock exception is it).Anyway, my result form bluk insert is: always use flush/clear and reload your entities. U should not care about massive database queries, as most of such work will be done at night ;)
greetings