MySQL does not enforce referential integrity and neither does Torque. You can make it enforce RI by overriding the relevant methods and adding the necessary checks yourself.
HTH, Scott -- Scott Eade Backstage Technologies Pty. Ltd. http://www.backstagetech.com.au .Mac Chat/AIM: seade at mac dot com On 27/01/2003 6:59 PM, "Xavier Ottolini" <[EMAIL PROTECTED]> wrote: > MySQL let me delete the record without error message. > > Here is an extract from the schema. > > <table name="B"> > <column name="AGENCE_ID" required="true" autoIncrement="true" > primaryKey="true" type="INTEGER"/> > <column name="NOM" required="true" size="255" type="VARCHAR"/> > <unique> > <unique-column name="NOM"/> > </unique> > </table> > > <table name="A"> > <column name="EXPERTISES_ID" required="true" autoIncrement="true" > primaryKey="true" type="INTEGER"/> > <column name="AGENCE_ID" required="true" type="INTEGER"/> > <column name="ARTICLE" required="true" type="VARBINARY"/> > <unique> > <unique-column name="AGENCE_ID"/> > </unique> > <foreign-key foreignTable="B"> > <reference local="AGENCE_ID" foreign="AGENCE_ID"/> > </foreign-key> > </table> > > > Quinton McCombs wrote: > >> What happens if you try to do the same thing directly on the database? Does >> it let you? >> >> >> >>> -----Original Message----- >>> From: Xavier Ottolini [mailto:[EMAIL PROTECTED]] >>> Sent: Friday, January 24, 2003 10:46 AM >>> To: Turbine Users List >>> Subject: Check foreign keys while deletion >>> >>> >>> Hi ! >>> >>> I have got a table A whith a foreign key to the Table B. >>> When I try to delete a record in the table B, I should >>> normally get an >>> error or an exception. >>> This is not the case : is is allowed ! >>> >>> Here is the source. >>> >>> public void doDelete(RunData data, Context context) >>> throws Exception >>> { >>> intake = (IntakeTool)context.get("intake"); >>> agenceGroup = intake.get("AgenceGroup", >>> ProjectConstantes.AGENCE_KEY); >>> Integer agenceId=null; >>> if ( agenceGroup != null ) >>> { >>> agenceId = >>> Integer.valueOf(agenceGroup.get("AgenceId").toString()); >>> Criteria criteria = new Criteria(); >>> criteria.add(AgencePeer.AGENCE_ID, agenceId); >>> AgencePeer.doDelete(criteria); >>> intake.remove(agenceGroup); >>> setTemplate(data, "/param/AgenceList.vm"); >>> } else { >>> context.put("errorTemplate", "Les données du >>> formulaire sont >>> inaccessibles."); >>> context.put("mode", "delete"); >>> data.getParameters().add("mode", "delete"); >>> setTemplate(data, "/param/AgenceForm.vm"); >>> } >>> } >>> >>> >>> Whant is wrong ? >>> >>> >>> -- >>> To unsubscribe, e-mail: >>> <mailto:turbine-user-> [EMAIL PROTECTED]> >>> For >>> additional commands, >>> e-mail: <mailto:[EMAIL PROTECTED]> >>> >>> >>> >>> >> >> -- >> To unsubscribe, e-mail: >> <mailto:[EMAIL PROTECTED]> >> For additional commands, e-mail: >> <mailto:[EMAIL PROTECTED]> >> >> >> > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>