Hi everyone,

Basically what I am trying to do is I have a function in a session
bean called setDBItems(String, String, String, String). This function
is supposed to do (in sequence)

1) sql insert to a table 'sabra' with the first two parameters of the
function.
2) an entity bean update using the 'account.credit(100.00)' function.
It updates the table accountums.
3) another sql insert to the table 'sabra' using the last two
parameters of the function.

My aim is to have one of these steps fail so that all the 3 database
inserts/updates rollback. e.g. if the step 3 fails, step 1 and 3
should rollback. This is working in Orion. That is the insert is done
by a normal PreparedStatement and not by and entity bean.

The next aim is to have the entity bean 'update' fail so that the
other normal 'sqls' rollback. The balance field in the accountums
table has a length of NUMBER(5,2) so when I call the entity bean's
credit (account.credit(12345.00)) the entity update should fail, which
should rollback all the other sqls.

Since this is a transaction on the setDBItems() the ejbStore() is only
called towards the end of the setDBItems() i.e. step 1) and step 2)
and step 3) happen, but only at the end of the transaction of the
setDBItems () the ejbStore() of the entity is being called. This is
fine and this is how it should work. The ejbStore() throws an
EJBException, but this is not being caught in the setDBItems(). If
this happened, then the setDBItems would be able to throw an
EJBException which would rollback everything and I would be a happy
man.

Now the main thing is that the Exception thrown by the store does not
come to the Session bean. I tried using the UserTransaction so that
when I say ut.commit(), the ejbStore() would be called and I could
catch the Exception thrown by the entity bean, but still in this case
the Exception is not being caught by the Session bean although the
code is there. I tried throwing a RemoteException with same results.

We are using Oracle.
Using the thin driver. (jdbc:oracle:thin:@192.168.0.5:1521:dcom)

This same program works well in J2EE. I had a previous problem with
transactions in Orion sometime back and found out that it was because
the Remote was throwing Exception instead of any other. When I changed
it to some RemoteException, it worked. So I am beginning to wonder if
Orion has a different way of implementing things. but anyway I guess
you would be able to see better reason on this.

If anyone has a working example of what I am trying to do (in Orion),
I would appreciate it if someone could send the same thing to me.

Thanks very much.

Thanks
Kind Regards
Aby Philip



Reply via email to