[jboss-user] [EJB/JBoss] - Transactions and persistence contexts

magnus.ahlander do-not-reply at jboss.com
Mon Jun 4 02:54:12 EDT 2007


I have a master EJB which reads a job description from a database and depending of this job description calls a few other EJBs. A typical job would look something like:

i) retrieve some data through FTP, SOAP or some other protocol (EJB1)
ii) validate, transform and filter the data (EJB2)
iii) persist data to database (EJB3)

Initially I didn't explicitly set any transaction attributes on the EJBs, so the transaction started and ended in the master EJB. However, the first phase, the retrieving of data, occasionally lead to an timeout.

Since actually only the EJB persisting data in the database needs a transaction, I explicitly set a transaction attribute 'SUPPORTS' on all EJBs except for the one persisting data in the database, which I set to 'REQUIRED'. However, I'm also modifying and persisting a part of the job description (which was read my the master EJB). The problem that occurs is that inside of the persisting EJB I have another persistence context than in the master EJB and consequently I get an exception.

Would be glad for any suggestions of how to manage my transactions and persistence contexts. Maybe I ought to use explicit transaction management?

Regards,
Magnus

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050802#4050802

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050802



More information about the jboss-user mailing list