Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transaction through EJB3

 
Jyoti Aggarwal
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recommend you go through this useful tutorial.
 
Jyoti Aggarwal
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • 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
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic