• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTA with Tomcat in JEE 6

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 27865
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic