1 Reply Latest reply on Mar 27, 2009 8:40 AM by Jens Weintraut

    using transaction:ejb-transaction in Java EE 5 envmt

    Arbi Sookazian Master

      I am running my Seam apps in a Java EE 5 environment (JBoss 4.2 AS).  My seam-gen'd 2.0.2.SP1 app does not have this metadata in the components.xml:

      <transaction:ejb-transaction />

      According to the Seam ref doc, By default Seam uses a JTA transaction component that
      integrates with Container Managed and programmatic EJB transactions. If you are working
      in a Java EE 5 environment, you should install the EJB synchronization component in
      components.xml: <transaction:ejb-transaction />

      Why is this not included by default when you run a 'seam setup' and then 'seam create-project', etc.?  Does the seam-gen tool just assume that your project is a POJO/Tomcat app not using EJB3 components?

      What happens if you leave it out as I did?  My transactions in my tests committed fine to the db tables.

      More from section 9.2.3 of the Seam ref doc:

      If in a Java
      EE 5 environment the <transaction:ejb-transaction/> component should be be declared
      in components.xml to ensure that Seam synchronization callbacks are correctly called if the
      container commits a transaction outside of Seam's knowledge.

      I noticed that the booking example's components.xml did have <transaction:ejb-transaction />.  My app is making use of the @TransactionAttribute annotations to specify transaction attribute types for various session bean publicly-exposed methods.  I've also learned that if you do that, then you can't use SMPC and manual flushMode and must resort to extended persistence from EJB3.

      Can someone please shed some light here?  This stack is extremely confusing when you're thinking about transaction semantics and which container (Seam or EJB) is responsible for what under what conditions (SMPC/manual flush, for example, vs. EJB3 extended PC and auto flush; global tx's, application tx's as per Dan Allen's book; BMT vs. CMT, etc).  What a total disaster here!