Good morning.
I have two databases.
First delete records of a table of the first database and after, these records deleted, i want insert it in a table of the second database.
I need these two operations are handled by a single transaction, because if a error occurs, i want to do a rollback over those two databases.
At first, i had a session and a transaction for the first database and another session and transaction for the second database. Then, i opened the two transactions simultaneously, but the operations worked bad. Maybe you can not open two transactions simultaneously:
Code:
Session session1 = HibernateUtil.getSession1();
Transaction tx1 = session1.beginTransaction();
Session session2 = HibernateUtil.getSession2();
Transaction tx2 = session2.beginTransaction();
.....
.....
operations....
.....
.....
Can anyone help me?