6 Replies Latest reply on May 31, 2004 11:23 AM by Holger Baxmann

    Foreign key set to NULL

    benzam Newbie

      Hello,

      I am using CMR and have encountered a case where the foreign key violation in the database is not thrown as an exception by Jboss. The details are as follows...

      I have a one to one relationship between two entities with a foreign key constraint in the database.
      On trying to delete the parent entity when the child entity(one with the foreign key) still has a valid reference to it (the FK) I was expecting an exception...that it cannot be deleted.
      However, each time I call the remove() method the parent entity (row in database) is deleted and the foreign key in the child entity(row in database) is set to NULL.

      This occurs only when I use entity beans with Jboss. The same code works as expected with other App servers.

      I am using Jboss 3.2.1 version and DB2 as the database.

      Any idea?
      Thanks.