Hi,

I've problems to update/replace an 1:1 relation.
When a new <Partner> is entered in the relation,
OJB will change the foreign key in the parent object, but
keeps the old child-object in the database.

Is it possible to let ojb remove the old child automagically
in the store operation?

Thanks.
Andreas.


Used settings:
- OJB 1.0.0
- field access: PersistentFieldIntrospectorImplNew
- Oracle


Code for retrieving and replacing the relation:

// Retrieve the object with the PB-API (QueryFactory)
// ... some code for steping through the datastructures

List l = vertrag.getPartnerListe();
Partner partner = (Partner)l.get(0);
Partner bezPartner = new Partner();

// ... set some attributes of bezPartner

// replace the old relation with a new one
partner.setBeziehungsPartner(bezPartner);

// update the database with the PB-API (broker.store())




The class with xdoclet:

/**
 * @ojb.class
 * 
 * @ojb.field
 *      name="partnerId"
 *      jdbc-type="INTEGER"
 *      autoincrement="ojb"
 *      primarykey="true"
 *
 * @ojb.field
 *      name="partnerBeziehungId"
 *      jdbc-type="INTEGER"
 */
public class Partner
{
   /**
    * @ojb.reference
    *      foreignkey="partnerBeziehungId"
    *      auto-retrieve="true"
    *      auto-update="object"
    *      auto-delete="object"
    */
   private Partner beziehungsPartner = null;

   public Partner getBeziehungsPartner()
   {
      return beziehungsPartner;
   }

   public void setBeziehungsPartner(Partner person)
   {
      beziehungsPartner = person;
   }
}

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

Reply via email to