• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

How to control transactions when using container managed Entity Manager

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,

I am recently started using JPA(Java Persistence API) as part of my EJB Application.

and i have one doubt..

I am using Container managed Entity Manager , so am i need to control transactions using begin(), commit(),rollback() methods.

OR will container manages it.

how to handle this...

can you please help me out.

 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it is container managed it should be integrated with your server's JTA transaction service. With EJB this will typically mean each SessionBean method will start and end a transaction automatically.

If you want to control the transaction yourself, then don't use a managed EntityManager, instead inject the EntityManagerFactory and obtain your own EntityManager.
 
varaprasad mutyala
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You James,

and sorry for late reply.
now i am clear about this issue.
reply
    Bookmark Topic Watch Topic
  • New Topic