-
May 11th, 2001, 10:59 AM
#1
EJB Transactions
Hi All,
I didn't find any actegory for EJB. That is why posting in this actegory.
I am having some clarifications about EJB transactions.
I am having a Session bean and two entity beans. I am using weblogic as the server. In my Session bean method I am interacting(creating) two entity beans. This two things I want to put it in a Single Transaction. For that In the deployement descriptor of Entity beans, I put the Transaction attribute 'supports' (<trans-attribute>Supports</trans-attribute>. In the Session bean I have put RequiresNew(<trans-attribute>RequiresNew</trans-attribute> as the attribute.
But unfortunately when I call the session bean method it is not rolling back if one bean interaction fails. Is anything else has to be specified in the bean inorder to accomplish this. Please help me. Any suggestions will be appreciated.
Sebas
-
May 12th, 2001, 03:17 PM
#2
Re: EJB Transactions
If I am not mistaken, EJB1.1 specs say that the trasaction won't be rolled back automatically.
They suggest to use context.setRollbackOnly() if you want to rollback a transaction in that case.
Plz tell me if I am wrong!
- UnicMan
http://members.tripod.com/unicman
-
July 17th, 2001, 04:53 PM
#3
Re: EJB Transactions
Hi,i am facing similar problem in transactions.if you have found a workaround could you post it please.Only difference is that my app server is silverstream
Thanks
-
July 20th, 2001, 04:29 AM
#4
Re: EJB Transactions
throw an exception from the entity bean...
then in the session bean method, rethrow the exception to the container....
it works with me.
-
July 23rd, 2001, 02:58 PM
#5
Re: EJB Transactions
but i have read that the container will rollback only if system exception occurs.But if an application exception occurs then it does not rollback the transaction.The user has to call setRollbackOnly() method explicitly to rollback.
Could you tell me what type of exception you were getting?
-
July 23rd, 2001, 08:50 PM
#6
Re: EJB Transactions
in your entity bean use try-catch to catch your application exception and re-throw it...
i normally rethrow it as java.rmi.RemoteException
-
September 14th, 2001, 05:39 AM
#7
Re: EJB Transactions
There is one more thing I found out in case of Orion App Server.
If you are trying on Orion, you should know that Orion server doesn't give error even if a method signature in descriptor is wrong or not specified.
I think Orion server assumes that if method signature is not given, its default trans-attribute is taken as 'NotSupported'.
I have a case where I had a descriptor with wrong method signature and whenever it used to fail, it used to say that it has rolled back transaction, but actually transaction wasn't rolledback.
After that I learnt that because my method signature was wrong in descriptor, it was assuming 'NotSupported' attribute, and so whatever DB updates I do, were getting stored.
I am not sure which app server are you trying, but ensure that signature in your descriptor matches exactly with the actual method.
I hope it helps you...
- UnicMan
http://members.tripod.com/unicman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|