The Artima Developer Community
Sponsored Link

Java Answers Forum
Propagating transaction from ejb to non-ejb

2 replies on 1 page. Most recent reply: Jun 21, 2002 4:41 AM by jinaraj

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
jinaraj

Posts: 8
Nickname: bullet
Registered: Feb, 2002

Propagating transaction from ejb to non-ejb Posted: Jun 19, 2002 10:21 PM
Reply to this message Reply
Advertisement
In my project, I am not planning to use Entity Beans. I am going for the DAO approach. But I want the transaction to be managed by the EJB container. But I have a doubt regarding propagation of transaction to DAO from Session bean. Imagine from a session bean's method, businessmethod(), which is declared to be "Required" for it's transaction attribute in ejb-jar.xml, has to call multiple methods on a DAO. The DAO methods encapsulates connection to the database and SQL. I want this multiple method calls on DAO to be atomic (Not through code. Container should do this). Using DAO approach, can I attain this? Or should I use Entity beans (Instead of DAOs) to get container managed transaction? Pleae advice.


Babu Reddy

Posts: 7
Nickname: babureddy
Registered: Jun, 2002

Re: Propagating transaction from ejb to non-ejb Posted: Jun 21, 2002 2:08 AM
Reply to this message Reply
U can u se the DAO well. It works fine but in all the methods that u are going to call in the DAO if any ecetion arrises thow the exception, Catch the Exception in EJB( Entity ) and Throw EJBException from EJB. If this happens in any method that u are calling all the transactions happend in the method call will be automatically rolled Back .
If not clear revert back
babu reddy

jinaraj

Posts: 8
Nickname: bullet
Registered: Feb, 2002

Re: Propagating transaction from ejb to non-ejb Posted: Jun 21, 2002 4:41 AM
Reply to this message Reply
Hi Babu, Thank you for the reply.
I feel I need to stress the point that I am not planning to use Entity bean. Your statement "Catch the Exception in EJB( Entity ) and Throw EJBException from EJB" forces me to use Entity bean again. I want to avoid this. I am calling DAO methods directly from my Session bean.

Flat View: This topic has 2 replies on 1 page
Topic: Java Code Safety Previous Topic   Next Topic Topic: hello problem in this code want solution

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use