Business tier (POJO) and Transaction Management (JTA)

Discussions

Web tier: servlets, JSP, Web frameworks: Business tier (POJO) and Transaction Management (JTA)

  1. Working on a project using JSF. I am trying to use POJO (within tomcat) to implement the business tier.

    If I use EJB, the transaction management using JTA within the business tier should be simple. Tomcat does not support JTA, the quesiton is how can I manage transaction within the business tier (implemented as POJO).

    I may rely on the transaction management of the data source (e.g. JDBC transaction, Hibernate transaction, etc.), which is a best practice suggested by several books. However, I do not want my business tier code rely on the integration layer API (e.g. Hibernate transaction API).

    One solution I can think about is to write a transaction wrapper API used in my business tier. Then, I can switch the implementation in between JTA and Hibernate transaction.

    Using Spring framework may be another choice. However, it will introduce a new API.

    Please advice. Thanks.

    Threaded Messages (3)

  2. Tomcat, JTA[ Go to top ]

    You CAN use JTA in Tomcat

    Here's how:

    http://www.onjava.com/pub/a/onjava/2003/07/30/jotm_transactions.html

    http://jotm.objectweb.org/current/jotm/doc/howto-tomcat-jotm.html

    http://www.mail-archive.com/tomcat-dev at jakarta dot apache dot org/msg51335.html

    If you prefer Jetty instead of Tomcat, try JettyPlus

    http://jetty.mortbay.org/jetty/plus/
  3. What's the best practice.[ Go to top ]

    Thanks. I also heard about Jotm and will try.

    Besides the implementation details, I'd like to hear more on this topic on the overral architecture design perspective.

    Should the transaction management exists in the business tier or integration tier? Should the business tier rely on the data source transaction management?

    A lot of books show very bad examples. Their Struts actions call DAO directly. Also, transaction management code exists in the DAO.
  4. What's the best practice.[ Go to top ]

    You may want to read this article:

       Advanced DAO Programming
       http://www-106.ibm.com/developerworks/library/j-dao/

    Also.... I recommend Rod Johnson's book "J2EE Design and Development"

    Rod is writing a 2nd book called "J2EE Development Without EJB"

    http://www.amazon.com/exec/obidos/tg/detail/-/0764558315/