0 Replies Latest reply on Dec 16, 2003 10:06 PM by gorano

    Cascade delete in one to many

    gorano Newbie

      I just discovered that cascade delete on a one to many unidirectional CMR doesn't work if a foreign key constraint is set on a DB-level.

      My Oracle throws a violation exception. Without fk-constraint everything is fine.

      It looks like JBoss tries to delete the parents before the children.

      Ok, this might not be a big deal, I can live without FK-constraint
      on my Oracle, but it would be nice to have them (in this place things goes live before the admin interfaces are ready ;-) )

      Maybe I'm missing something important in my DD (X-Doclet):

      /**
      * @ejb.interface-method
      * view-type="local"
      *
      * @ejb.relation
      * name="Principal-Role"
      * role-name="one-principal-has-many-roles"
      * target-ejb="Role"
      * target-multiple="no"
      * target-role-name="many-roles-belongs-to-one-principal"
      * target-cascade-delete = "yes"
      *
      * @jboss.target-relation
      * related-pk-field="id"
      * fk-column="PRINCIPAL_ID"
      * fk-constraint = "yes"
      */

      Thanks

      Goran