9 Replies Latest reply on Mar 8, 2005 5:42 AM by Jbm Jbm

    Adding CMR fails

    Jbm Jbm Newbie

      Hello,

      I m facing a problem with JBoss 3.2.5 which does not exist under JBoss 3.2.2.

      Here is my problem :

      I have 2 entities A and B, with a 1-n relationship.
      When we add many B to a A we do , inside A :

      while(B_lentgh) {
      BLocalHome home = BUtil.getLocalHome();

      // Create the B entity
      BLocal relation = home.create(bDTO);

      // Add the new B entity to A
      getB().add(relation);
      }


      So this code is executed by the entity A.
      Problem, it seems that the "getB().add()" method is not commited right after the B entity creation.

      Therefore when we get inside the loop for the second time a new B entity is created, but the previous one is still not added to A (it's foreign key is null)

      Because I have DB constraints on the foreign key (unique constraint coupled with another attribute), I get an oracle exception.


      I hope that this pseudo code is understandable :-)
      Also note that this part is generated by XDoclet (in the aCMP class).
      And again, this is working under 3.2.2 but not 3.2.5 (and we need 3.2.5)

      Thanks for your help.
      J&B