hi vincent,

afaik the sequence of deleting id ok. in a 1:1 relation the object on the left contains the key of the object on the right.
so the left object has to be deleted first.


  <class-descriptor
     class="brj.ojb.Person"
     table="tabPerson"
  >
     <field-descriptor
        name="id"
        column="id"
        jdbc-type="INTEGER"
        primarykey="true"
        autoincrement="true"
     />
...
      <field-descriptor
        name="idPartner"
        column="idPartner"
        jdbc-type="INTEGER"

     <reference-descriptor
        name="partner"
        class-ref="brj.ojb.Partner"
        proxy="true"
        >
        <foreignkey field-ref="idPartner"/>
     </reference-descriptor>
...
  </class-descriptor>


in the above mapping Person has to be deleted before Partner.


hth
jakob

Vincent Frison wrote:

Hello there,

I use to declare my foreign key as constraints at the DB level (INTEGER
REFERENCES "anotherTable" under PostgreSQL) which seems to be the very
traditional way to do. But.. I get troubles with OJB.

For example, if I have a two classes, each of them do 1:1 mapping to the
other one, and if I want to do some deleting on cascade
(auto-delete="true"), referential integrity violations occur. But it
shouldn't happen if the referenced object is deleted first! This is not
the case?

Actually I work around it by removing REFERENCES in my tables creations,
adn deleting on cascade works fine. But maybe this is normal way since
this is the work of OJB to manage the references. But there's no way to
keep the DB level referential integrity?

Vincent


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to