0 Replies Latest reply on May 29, 2006 2:09 AM by Peter Voringer

    Extended EntityManager

    Peter Voringer Newbie


      is there a way, to share an Extended EntityManager between Stateful SessionBeans (SFSBs)?

      If i inject an SFSB B in another A with an injected EM in both the lifecycle of A and B are bind together, but not the transaction. So if A is removed B is also removed but both synchronizations together with the Database are not atomic. So if B works and A fails, changes made in B were not rolledback.

      If i try to write somethink like a Factory SFSB A which has an injected EntityManager and gives out another SFSB B were A initialized B with A's EntityManager i get an Exception (it looks like it is unfortunatelly not possible to give out the EntityManager).

      Another alternative is implemented via Command-Pattern, where only SFSB A has an Injected EntityManager and B creates only Commands which were executed in A. This works, but is not very efficient.

      So someone has a hint how to solve this problem?