This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

JTA with Tomcat in JEE 6

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

Posts: 21753
Android Eclipse IDE Tomcat Server Redhat Java 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
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

Friends help you move. Good friends help you move bodies. This tiny ad will help:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!