0 Replies Latest reply on Apr 16, 2002 6:49 AM by sal ingrilli

    FK violation does not rollback the transaction

    sal ingrilli Newbie

      public class TestSLBean implements SessionBean {
      public void myTest () throws Exception {

      ParentHome parentHome = (ParentHome) HomeBuilder.buildHome (Parent.class, ParentHome.class);
      Parent parent = parentHome.create (new Long (100), "My First Parent");
      ChildHome childHome = (ChildHome) HomeBuilder.buildHome (Child.class, ChildHome.class);
      Child child = childHome.create (new Long (100), badParentFk);

      I create the parent.
      I create the child, but the FK to the parent is BAD.
      I expect the FK violation ("Cannot add a child row: a foreign key constraint fails") to rollback all changes.
      Instead, Parent is created and child is not!
      What am I doing wrong? Shouldn't the transaction have been rolled back?
      What if the server goes down at that point... is this JBoss, or my driver/db configuration?

      All my cmps have

      All my slbeans have

      Running 2.4.4 & mySql 3.23.47 with InnoDb with mm's 2.0.11 driver.