Web tier: servlets, JSP, Web frameworks: Business tier (POJO) and Transaction Management (JTA)
Working on a project using JSF. I am trying to use POJO (within tomcat) to implement the business tier.
- Posted by: Derek Shen
- Posted on: February 09 2004 16:37 EST
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.
You CAN use JTA in Tomcat
http://www.mail-archive.com/tomcat-dev at jakarta dot apache dot org/msg51335.html
If you prefer Jetty instead of Tomcat, try JettyPlus
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.
You may want to read this article:
Advanced DAO Programming
Also.... I recommend Rod Johnson's book "J2EE Design and Development"
Rod is writing a 2nd book called "J2EE Development Without EJB"