At 15:55 29.10.2003, Adrian Brock wrote:
I'm not sure I understand your question.
A transaction rollback could happen at any time
due to a transient or permenant failure.

In the same trasaction I create new user entity bean, address entity bean and user data entity bean [in the last mail -> public UserVO createNewUser(UserVO userVO, User_DataVO user_dataVO, AddressVO addressVO)]. In the same method I have to set the right user_data_id foreign key in my user entity bean [userLocal.setUser_data_id(user_dataLocal.getUser_data_id())]. But if I set a wrong id [only for testing what happens -> userLocal.setUser_data_id(new Long(20000))], which dosn't exist in the db, than this failed while:


java.sql.SQLException: General error, message from server: "Cannot add or update a child row: a foreign key constraint

I can't catch this and my servlet failed with:

HTTP ERROR: 500 Store failed; CausedByException is: General error, message
from server: "Cannot add or update a child row: a foreign key constraint
fails"; CausedByException is: Store failed; CausedByException is: General
error, message from server: "Cannot add or update a child row: a foreign
key constraint fails"


Regards, Rafal


You can analyse the cause of the exception
by following the linked exceptions
in EJBException.or RemoteException.

e.g. This code is used inside JBoss to discover
whether an execption is thrown due to an
application deadlock.

   public static ApplicationDeadlockException isADE(Throwable t)
   {
      while (t!=null)
      {
         if (t instanceof ApplicationDeadlockException)
         {
            return (ApplicationDeadlockException)t;
         }
         else if (t instanceof RemoteException)
         {
            t = ((RemoteException)t).detail;
         }
         else if (t instanceof EJBException)
         {
            t = ((EJBException)t).getCausedByException();
         }
         else
         {
            return null;
         }
      }
      return null;
   }

Regards,
Adrian

[...]




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to