• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Transaction through EJB3

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

I created an application that has EJB3 and Hibernate3. Initially I was jus calling the method in Dao layer from EJB and there for every method get new hibernate session and do the transaction and so on...
Now i hav ben asked to do all the transaction from EJB layer itself. I have no clue how to begin with the same. i am using stateless session beans. and MySql database.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I recommend you go through this useful tutorial.
 
Jyoti Aggarwal
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am not able to undestarnd that is it necessary to use persistance.xml. Initially I was using hibernate.cfg.xml. If yes where am i going to map hbm.xml mapping and how to call the session
please its really urgent
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you question is not about container managed transactions its about transaction scoped session management? In which case the Hibernate documentation will explain what to do.
 
Jyoti Aggarwal
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have already gone through that ....
Ok I have one DAO layer having sesssionFactory of hibernate. then there is this class doing all transaction




In my EJB folder
I have put


have no idead whether PersistenceContext private EntityManager em; is required or not

No how do i open transaction in ejb
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


No how do i open transaction in ejb


See my first reply. The mechanism is called container managed transactions and is one of the basics of EJBs. I would strongly recommend you go through the linked tutorial before doing much more with EJBs. It will make your life much easier if you have a good grasp of the basics
 
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic