-
1. Re: EntityManager.flush not flushing
lpmon Aug 9, 2007 4:03 PM (in response to dahunter)I am having a similar problem.
It appears entityManager.flush() is ignored. I never see data making it to the DB unless all methods in a stack of SLSB methods exit.
If I run the same identical code with a few inserts all is well. If I run it with thousands of inserts my app crashes due to lack of memory. The whole point of calling flush is to release the memory!
This seems like such a fundamental thing I am wondering if there is some setup I am missing. I find it hard to believe this bug would exist since it is so important for it to work properly.
Using:
JBoss AS 4.0.5
MySQL 5.???
Injected EntityManager
Ideas anyone? -
2. Re: EntityManager.flush not flushing
dahunter Aug 9, 2007 4:15 PM (in response to dahunter)I did find a work around to this. It seems that any method that referenced the EntityManager had to be in a transaction, and the whole method had to complete before the commits occured.
To work around it I removed all references to the EntityManager from my session bean with the timer and set my long running (looping) method so that it doesn't support transactions.
I then created another bean that performs the actual database writes. I then called those methods that write to the database from within the long running (looping) method.
It seems like a lot of overhead to require this to be done in different beans, but it did work.
DaHunter