Originally posted by Ramakrishnan Thanjavur: when i call home.create("P123") ( that key is already exists ), i getting remote exception instead of duplicatekey (or create) exceptions. what is the reason.
similarly when will i get create, remove or finder exceptions, who is responsible for throwing it, bean provider or container.
These are all application exceptions, so they are bean providers responsibility.
DuplicatekeyException are supposed to be passed to the client directly instead of being wrapped as RemoteException. So probably your code encountered some other system exception.
The client can invoke getCause to return the wrapped remote exception.
Also, it seems as if EJBException was thrown, causing the container to throw RemoteException as the client is remote. This is why RemoteException rather than DuplicateKeyException was thrown to the client.
This is what I think is happening. When the insert fails, WebLogic Server throws weblogic.utils.NestedRuntimeException, which is a RuntimeException. As the client is remote, WLS complies with the EJB spec by thowing RemoteException to the client.
In any case, I think the client will always get RemoteException as the transaction is marked for rollback, which explains why TransactionRolledbackException (a subclass of RemoteException) is thrown by WLS.
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
It's never done THAT before. Explain it to me tiny ad: