A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
EJB and other Java EE Technologies
EJBs and transactions
Joined: Jul 12, 2001
Apr 25, 2005 20:20:00
I have trouble understanding the
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?
Thank you very much.
Joined: Apr 06, 2005
Apr 26, 2005 01:47:00
Why cant you have container managed transaction
[ April 26, 2005: Message edited by: Kanishtha Kramalekhaka ]
I agree. Here's the link:
subject: EJBs and transactions
Stateless Session Beans Managing JDBC Transactions
Closing Statement object prior to committing
A query...plz help!!
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014