File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes EJBs and transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJBs and transactions " Watch "EJBs and transactions " New topic
Author

EJBs and transactions

Sreenivasa Majji
Ranch Hand

Joined: Jul 12, 2001
Posts: 224
Hi,

I have trouble understanding the J2EE transactions and database transactions.

I have an ejb which pulls data from one datasource, do some calculations and pushes the data to another data source.

When i push the data, i need to push it to more than 1 table and some times i have to insert more than one record on the same table. All this should happen in a single trnsaction.

Currently what we are doing is inserting a single row in table, committing it before inserting another record in another table. I believe this is wrong.

My options are pass the same connection to all the DAOs so that they can use the same connection and commit/rollback based on exceptions.

Are there any other mechanisms, other than passing the same connection to all the DAOs (because all the tables in the same database instance).

If so, what should i do in the DAOs? shall i remove all the commit/rollback statements from DAOs?

How do you solve this kind of problem when you want to talk two different types of databases and commit/rollback?

Any pointers??

Thank you very much.


Sreenivasa Majji
Mudi Appu
Ranch Hand

Joined: Apr 06, 2005
Posts: 44
Why cant you have container managed transaction (CMT)?

read this topic too
[ April 26, 2005: Message edited by: Kanishtha Kramalekhaka ]

SCJP 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJBs and transactions