0 Replies Latest reply on Jun 4, 2007 2:54 AM by Magnus ahlamag

    Transactions and persistence contexts

    Magnus ahlamag Newbie

      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