aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Transaction through EJB3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Transaction through EJB3 " Watch "Transaction through EJB3 " New topic
Author

Transaction through EJB3

Jyoti Aggarwal
Ranch Hand

Joined: May 26, 2009
Posts: 33
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

Joined: Apr 14, 2004
Posts: 10336

I recommend you go through this useful tutorial.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jyoti Aggarwal
Ranch Hand

Joined: May 26, 2009
Posts: 33
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

Joined: Apr 14, 2004
Posts: 10336

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

Joined: May 26, 2009
Posts: 33
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

Joined: Apr 14, 2004
Posts: 10336


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
 
subject: Transaction through EJB3
 
Similar Threads
Transaction Demarcation
Question about transactional attribute and session beans....
EJB2 CMP - Delayed DB Write
Carrying transactions over 2 application servers?
Technology related question