1 Reply Latest reply on Oct 30, 2001 10:07 PM by David Jencks

    Removing self-referential cmp ejbs.

    Joern Newbie

      Hi all,
      I'm using Jboss 2.4.1 with an Oracle DB. I got myself a set of cmp entity beans which contain a member parent_id, pointing to another of these ejbs.
      Now, removing an ejb #pk should result in dependant ejbs (i.e. those with parent_id = pk) to be kept in storage, but with an parent_id of null.

      Here's the code I'm trying to achieve this with (from an facade ejb):

      Iterator i = avlhome.findByParent_ID(pk).iterator();
      while(i.hasNext()) {
      AVList avl = (AVList)i.next();
      AVListData avldata = avl.getData();
      avldata.parent_id = null;

      This code results in a RemoveException: Could not remove [insert pk here], seemingly because the oracle db has a referential integrity constraint on column parent_id. After disabling this constraint, everything runs just fine.

      Is there a way to do the remove process and have the db constraint enabled?