I have a problem with transaction timing out and I know how to increase the time out interval but I would just like to learn as to what exactly is going on and how I can fix the problem without increasing the timeout.
class RequestProcessor {
public void do() {
// very long process
doSomeWhereLongProcess()
.....
// retrieve another session bean
persistence = (IPersistence) ctx.lookup( IPersistence.JNDI_NAME );
persistence.insert()
.....
doSomeProcess();
}
}
public class PersistenceFacade implements IPersistence {
@PersistenceContext
private EntityManager em;
// calls an entityManager to retrieve
public void retrieve()
}
RequestProcessor is a session bean that is being called remotely. In ejb-jar.xml transaction type is set to Bean.
It calls another session bean called PeristenceFacade that contains entity manager to insert entity beans. The transaction type in PersistenceFace
is set to Container.
While still executing a doSomeWhereLongProcess I get notification in log that transaction timed out and when it tries to called PersistenceFacade
I get an exception. What would it start a transaction even before I looked up a PersistenceFacade?
I tried setting transaction type to Bean in PersistenceFacade but it is complaining that EntityManager must have a transaction.
What is the proper way of handling this type of scenario?
Thanks