4 Replies Latest reply on Jan 14, 2003 11:03 AM by Ignacio de Cordoba

    CMP-CMR: possable to remove parent record while child record

    Jan Motin Newbie

      I have a CMP-CMR relation between a Supplier and a Company as shown below:

      table Company {
      companyid
      ...
      }

      table Supplier {
      supplierid
      companyid <fk references Company>
      ...
      }

      !I have no cascade delete option!

      When I remove a company that has one or more suppliers without first removing the suppliers JBoss will set all the relation fields of the suppliers to null and then remove the company.

      My expected behaviour was that JBoss should throw a removeException telling that you can't remove the company due to violation of referential constraints.

      This is big problem because the operation leaves child records in the database without having a parent!

      Can anyone verify this behaviour?

      A relational database would throw an exception in this case!

      /motin