posted 19 years ago
I have a scenario where I have two business entities. Say B1 and B2. I have writen Stateless session beans for B1 and B2. I have B1DB, B2DB which my session beans would talk to, inorder to make any database queries. I haven't decided if I have go with entity beans for B1DB and B2DB.
Now, on few scenarios when I update B1 data, I have to update B2 data. To acheive this,
1. I can call B2 update method from B1 update method. In this case how can I control transaction. I mean if B2 update is unsuccessfull, I have to roll back B1 update and vice versa. If I specify trasaction=true for business beans in the deployment descriptor would take care this situation?
2. Write a stored procedure that would update both the tables and commit whole transaction on sucess else roll back.
Is this the correct approach?.
Please suggest me.
Saritha