I am working with OC4J (nee Orion) and have found 2 really weird things going on involving EJBExceptions, and I was hoping someone else had run into these issues and could help me.

1) I thought that throwing an EJBExeption from a stateless session bean method in a Required transaction context was enough to roll back the transaction (and kill the bean instance). Calling SessionContext.setRollbackOnly() shouldn't be necessary. I have tried both approaches (just throwing EJBException and calling SessionContext.setRollbackOnly() when an exception is thrown), yet in both cases any database changes that have been made are not rolled back. Do I have to explicitly place the entity beans involved in a transaction context as well even if their methods are ultimately called by the session bean in question? I thought the transaction context just propagated all the way through....

2) I thought that when an EJB exception is thrown at the bean level, the client should receive a RemoteException (whose Throwable detail member contains the details of what happened). However, my test client is receiving a null.

For example, assume I have TestBean, TestHome, and Test, and Test (and TestBean of course) has a method called foo (original I know). The client uses TestHome.create() to get an instance of Test. He then does something akin to
         
                 Object o = Test.foo();

but TestBean.foo() throws an EJBException. I assumed that the client would receive a RemoteException in this case, but instead in my application foo() returns null. Thus any calls on the o reference throws a NullPointerException. Can anyone explain this?

I assume both these problems can be fixed by configuring something in one of OC4J's several deployment descriptors. If someone could let me know where and how to edit them, I would be very appreciative.

Thanks.