• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTA with Tomcat in JEE 6

 
senthinil kumar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi


We have planned to migrate spring application and use Java enterprise edition 6 / JSF / Hibernate with Tomcat 7 in our project, no TomEE please, and we need the following requirements to be fulfilled :
* EntityManager to be injected in stateless session beans
* TransactionManager will be JTA with atomikos
Please let me know how to inject the entitymanager with @PersistenceContext, entitymanager is always null in tomcat, and also the configurations to be done for using JTA as the transaction manager

Regards
Sentil
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My most common projects are in a similar form, although I don't use the EJB term "stateless session bean".

I actually have 2 persistence layers: The DAO layer, which handles basic single-table operations (CRUD/finders), and the Service layer, which handles sets of persistent objects handle as single transactions.

For both layers, I use the @Repository annotation on their respective classes, which, when paired with proper Spring configuration allows them to be referenceable via the auto-wiring mechanism and the JSF/Spring EL bridge. I use the @Transactional annotation to ensure automatic transaction framing.

I don't inject the DAOs with @PersistenceContext, I inject them with @EntityManager. The Service beans don't have any explicit persistence context, since they employ the DAOs to do the actual database persistence operations.
 
senthinil kumar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

In my few days exploring JEE 6 /tomcat JTA / Resource Local transactions is possible with much more easier than spring. Even the entitymanager can be injectable in JEE 6 . From whatever I have explored spring is nothing more than added weight, when all things is possible and also restful soa in JEE 6 , whatever you can do with spring, Why Spring??? Just a overload to JEE 6


regards
sentil
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!