I am having 3 session beans.
1)citibank bean
2)standard bean
3)global
citibank bean
--------------
Database
table:citibank
fields:name,amount
i have bussiness method called
public boolean credit(String name,int amount) throws RemoteException{
--->value will be added if name exist in table
-- >throws remote exception if name doesn't exist
}
ejb-jar file
-------------
<transaction-type>Container</transaction-type>
<trans-attribute>Supports</trans-attribute>
standard bean
--------------
Database
table:standard
fields:name,amount
i have bussiness method called
public boolean debit(String name,int amount) throws RemoteException{
--->value will be debited if name exist in table
-- >throws remote exception if name doesn't exist
}
ejb-jar file
-------------
<transaction-type>Container</transaction-type>
<trans-attribute>Supports</trans-attribute>
global bean
--------------
i have bussiness method called
public boolean transferSTtoCT(String name1,String name2,int amount) throws RemoteException{
--->firset calling standard bean's debit method
debit(name1,amount)
---->second calling citibank bean's credit method
credit(name2,amount)
-- >throws remote exception if anyone throw RemoteException
}
ejb-jar file
-------------
<transaction-type>Container</transaction-type>
<trans-attribute>RequiresNew</trans-attribute>
Client
---------
case1
transferSTtoCT("ab","ab",100)
case2
transferSTtoCT("ab","gh",100)
First param of transferSTtoCT() goes to debit() method
Second param of transferSTtoCT() goes to credit() method
Third param of transferSTtoCT() goes to both credit() & debit() method
I am having name "ab" in both table(citibank & standard)
and name "gh" not in the both table
In case1
------------
in this case it works well
it will debit in the standard and credit in citibank
since both citibank bean and standard bean dosen't
throw any exception
In case2
----------
in this case am getting problem
it's debiting amount in the standard
credit method throws RemoteException since name"gh" is not
in the table
result should be: standard should rollback
but for me standard is not rollbacked
Eventhough i am throwing exception in all the 3 bean
inorder to rollback if something goes wrong
What should be done inorder to work well!!!
Anyone help in this regard.
Thanks in advance
vinoth.c
cvinoth at chn dot cognizant dot com
-
Doubts in Transcation(not getting output) (2 messages)
- Posted by: vinoth chidambaram
- Posted on: January 10 2001 07:51 EST
Threaded Messages (2)
- Doubts in Transcation(not getting output) by Leo Shuster on January 10 2001 16:59 EST
- Doubts in Transcation(not getting output) by John Yost on January 11 2001 08:44 EST
-
Doubts in Transcation(not getting output)[ Go to top ]
- Posted by: Leo Shuster
- Posted on: January 10 2001 16:59 EST
- in response to vinoth chidambaram
Do you have transaction isolation level set to REQUIRED in your Bean's XML descriptor?
Leo
-
Doubts in Transcation(not getting output)[ Go to top ]
- Posted by: John Yost
- Posted on: January 11 2001 08:44 EST
- in response to vinoth chidambaram
Hi,
Pretty sure Leo is on the right track here-- you should declare transaction REQUIRED. If the transaction attribute in the deployment descriptor is SUPPORTS, then the method invocation will only occur within a transaction if the calling bean is already within a transaction context. I think this is why the rollback is not occuring.
John