hi,

how can i update a field with type of collection ?

details:
i define a persistent object with an attribut motive:

<class name="classes.Auftragssatz" ...
    <field name="motive" type="classes.AuftragssatzMotiv" collection
="collection" lazy="false">
          <sql many-key="auftrag_id" />
    </field>
</class>


in my class Auftragssatz there are four motive-methods:

    public java.util.Collection getMotive() {
        return motive;
    }

    public void setMotive(java.util.Collection motive) {
        this.motive = motive;
    }

    public void addAuftragssatzMotiv ( AuftragssatzMotiv motiv ) {
        if ( ! this.motive.contains(motiv) ) {
            this.motive.add(motiv);
            motiv.setAuftrag(this);
        }
    }

    public void removeAuftragssatzMotiv ( AuftragssatzMotiv motiv ) {
        if ( this.motive.contains(motiv) ) {
            this.motive.remove(motiv);
            motiv.setAuftrag(null);
        }
    }

i get a thin object of Auftragssatz (AuftragssatzThin) which
contains data for attributs only among others motive. what i want
is update motive like
AuftragssatzThin asNew = getAsNew() ;
:
db.begin()
Auftragssatz as = (Auftragssatz )db.load(Auftragssatz .class, asNew.getId
());
as.setMotive(asNew.getMotive());
db.commit();

thats mean, old motive must be remove and new create.
how can i implement this ? (AuftragssatzMotiv is not depended from
Auftragssatz)

regards
antje

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to