This is a tricky one ;)
I had the same question... so i did some research...
I didn't find any help in the
Java documentation, because they always report the same thing. The Remote Exception is thrown for system exceptions and if you look at some documentations, it tells you that the method might have been completed or not.
The interesting thing, though, is that "RemoteException" is also used by java.rmi to indicate a "communication problem". I didn't find a definitive explanation, but my guess is the following:
If your method completes correctly, and let's say you want to get back a detached entity which is serialized before being sent back, at that point the method is completed but something can happen between the method completition and the sending of the information via rmi, which will cause a communication problem and probably the throwing of that RemoteException. And the client might not know if the transaction was rolled back or not...
As a rule, if there is a System exception, the transaction is rolled back and the bean is discarded. After that, if you call again the same method on a Stateless bean, it might go thru if it was just a temporary glitch (you will not use the original bean, because it was discarded, but you will get another one from the pool).
If on the other hand it was a Stateful bean, you will need to check if the bean is still there. If you call a method of the bean and get "NoSuchEJBException" means that your original bean was discarded...if you call and it is still there.. it means your method completed successfully...
I hope somebody else with more experience might help on this a little more ;)
By the way, you asked:
what exactly holds ? is a transaction rolled back and the bean instance destroyed by the container on receiving a runtime exception ?
... a non application exception is a system exception ... so, yes... it will be rolled back and the bean instance destroyed...
Dave