I have two stateless session beans A and B , both of them having Container Managed transaction.
A client initiates one method of A which is calling a method of B in a loop some 100 times, which is doing some insertion of record in Database. This operation takes a lot of time. So if another client tries to view the records in between that operation , he is not able to view the already inserted records because the records will not be committed(after returning from B) until the call from A returns.
How can i view the already created records from another client? how can i get the data be committed after each successful insertion of record? Should i make bean A Bean managed transaction?
-
Commiting of transaction (2 messages)
- Posted by: kapil jaiswal
- Posted on: June 06 2003 09:10 EDT
Threaded Messages (2)
- Commiting of transaction by Mohit Dilawari on June 06 2003 11:52 EDT
- Or change the isolation level by SAF . on June 06 2003 12:30 EDT
-
Commiting of transaction[ Go to top ]
- Posted by: Mohit Dilawari
- Posted on: June 06 2003 11:52 EDT
- in response to kapil jaiswal
I do not think you need to convert the "B" EJB to Bean Managed. (Although, that can work) Change the transactional attribute of the "B" EJB to "requiresNew". This will start a new transaction, everytime B is called.
The downside to this approach is that this process will take longer, because you have 100 commits instead of 1 commit. -
Or change the isolation level[ Go to top ]
- Posted by: SAF .
- Posted on: June 06 2003 12:30 EDT
- in response to kapil jaiswal
If dirty reads are not an issue in your application, then instead of setting the transactional attribute on EJB B's method to RequiresNew, simply change the Transaction Isolation level to READ_UNCOMMITED, provided your database supports this isolation level, I know Oracle does not support it.
Raf