I'm stuck in a problem. I have a timer service method, which does a long task. When it starts working, it gets a list of objects from the database using another EJB (which uses EntityManager to get the list). Now as the timeout method is doing its job, after 5 minutes I get this exception
Now I don't know if this exception is due to some sort of persistence of the timer service or the list that I got from the database. The code to get the list is simple
So I suppose this must not be the cause as the result list will not be managed when it is returned from this EJB method to the timer service method. So I'm guessing that this has to do something with persistence of the EJB but I'm not sure. I'm using jBoss AS 4.0.4 (patched for EJB 3). Any help would be appreciated...
I've found the solution. I learned from this article that timers are created with their own transaction to be able to access entities. So that transaction was timed out after 5 minutes. So to solve that there were two solutions in front of me,
1. I use the @org.jboss.annotation.ejb.TransactionTimeout annotation to set the timeout to a longer value (which I think is only supported by jboss)
2. Use the @javax.ejb.TransactionAttribute annotation and use TransactionAttributeType.NEVER so that that timeout method doesn't get a transaction.
I used the second method as my timeout method didn't access entities directly from the database. I hope this might help other who get stuck like me ...
subject: Exception in Timeout method after 5 minutes