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.
JBoss AS 4.0.5
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.