This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes session bean in  database transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "session bean in  database transaction" Watch "session bean in  database transaction" New topic
Author

session bean in database transaction

shekarasankaran
Greenhorn

Joined: Nov 12, 2001
Posts: 18
Hi all
Would it be advisable to use session bean inspite of entity bean to perform any database transaction . If yes then tell y or else if not advisable tell what advantages do we gain from an entity bean
Thanks in anticipation
Rasmeet Devji
Greenhorn

Joined: Dec 08, 2000
Posts: 17
Stateless Session Beans could be used for transactions involving more than one table. This is where your Java Transaction API and TX DataSource come into picture.
You could get the Transaction object from the EJBContext's getUserTransaction() method
and then, get your SQL statements in place within a try and catch block.
Remember, you need to use the transaction.begin(), transaction.commit() and transaction.rollback() methods to ensure your transaction works fine !!!
Hope this helps.
Regards.
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
"shekarasankaran",
Thanks for joining JavaRanch, but could you just take a quick look at the naming policy and edit your profile accordingly.
Thanks!
Simon
Bartender (moderator) of "J2EE and EJB" forum
 
Don't get me started about those stupid light bulbs.
 
subject: session bean in database transaction
 
Similar Threads
Bean Managed Transactions
Session bean tranasactions with CMP
Bean Managed Transactions
Simple session bean question
How to deal with transaction??