1 Reply Latest reply on Feb 17, 2007 11:56 AM by Gavin King

    Seam-managed persistence contexts ok to use outside conversa

    Leo Baschy Novice

      I think I read all of reference documentation chapter 8 including section 8.3. Seam-managed persistence contexts.

      Would like to know official position (other than whether an experiment would show it works).

      Can a Seam-managed persistence context be used outside a conversation?

      What do I mean? E.g. in a message driven bean that isn't a Seam anything.

      Why? We use Seam for UI and I'm looking forward to use it even for non-UI. But we also have tasks that get scheduled by timers, and by fetching megabytes over HTTP they could run for minutes, or huge file format conversions could eat CPU cycles, and my colleagues care to fine tune load balance with JMS (e.g. dynamically change timer interval). In a non-seam MDB, can I

      @In EntityManager ourDatabase;


      or do I have to

      @PersistenceContext EntityManager em;


      The real reason why I'm asking is to know whether I can reuse the same pieces of code (e.g. a stateless session bean, I think) in the Seam UI as well as in the JMS driven bean with the same "one kind" injection, i.e. with

      @In EntityManager ourDatabase;


      or do I have to keep track of what code is calling, from within a Seam conversation or not, to make sure it matches one kind of EntityManager (Seam's) or the other (@PersistenceContext)?