Marco,
can you try to call setAutostore(true) on the Database instance before issuing
the remove() call ?
Regards
Werner
On Tue, 28 Dec 2004 11:37:13 +0100 (CET), [EMAIL PROTECTED] wrote:
>Hi all,
>
>I have 3 tables, how could I remove a 'benutzer' with his relations in table
>rechte and nole?
>I could only remove a 'benutzer' without hiis relations.
>
>..
>BenutzerData benutzer = (BenutzerData)db.load(....);
>db.remove(benutzer);
>..
>
>----------------------
>|benutzer |
>---------------------- 1
>| id int | -----------
>| kennung char(4)| |
>|... | |
>---------------------- |
> |
>---------------------- |
>|rechte | |
>---------------------- 1 |
>| id int | --------- |------
>| benutzerId int |<--------- |
>|... | 0..* |
>---------------------- |
> |
>---------------------- |
>|nole | |
>---------------------- |
>| id int | |
>| rechteId int | <--------------
>|... | 0..*
>----------------------
>..
>
>Class BenutzerData:
>
>....
>
> /**
> * @return Returns the rechte.
> */
> public Collection getRechte() {
> return rechte;
> }
> /**
> * @param rechte The rechte to set.
> */
> public void setRechte(Collection rechte) {
> this.rechte = rechte;
> }
> /**
> *
> * @param add _recht to Collection rechte
> */
> public void addRechte(RechteData _recht){
> this.rechte.add(_recht);
> _recht.setBenutzer(this);
> }
> /**
> * @param delete _recht from collection rechte
> */
> public void removeRechte(RechteData _recht){
> this.rechte.remove(_recht);
> }
>...
>---------------------------------------------------------------
>
>Class RechteData:
>..
> /**
> * @return Returns the nole.
> */
> public Collection getNole() {
> return nole;
> }
> /**
> * @param nole The nole to set.
> */
> public void setNole(Collection nole) {
> this.nole = nole;
> }
> /**
> * @param add _nole the Collection nole
> */
> public void addNole(NoleData _nole){
> this.nole.add(_nole);
> }
> /**
> * @param delete _nole from collection nole
> */
> public void removeNole(NoleData _nole){
> this.nole.remove(_nole);
> }
>..
>--------------------------------------------------------------------------
>
>class NoleData:
>..
>
> /**
> * @return Returns the mstelle.
> */
> public Collection getMstelle() {
> return mstelle;
> }
> /**
> * @param mstelle The mstelle to set.
> */
> public void setMstelle(Collection mstelle) {
> this.mstelle = mstelle;
> }
> /**
> * @param add _me to the collection mstelle
> */
> public void addMstelle(MeldestelleData _me){
> this.mstelle.add(_me);
> _me.setNoleData(this);
> }
> /**
> * @param delete _me from collection mstelle
> */
> public void removeMstelle(MstelleData _me){
> this.mstelle.remove(_me);
> }
>..
>------------------------------------------------------------------
>
>mapping.xml:
> <class name="BenutzerData" identity="id" key-generator="MAX" >
> <map-to table="benutzer" />
> <field name="id" type="integer">
> <sql name="id" type="integer" />
> </field>
> <field name="kennung" type="string">
> <sql name="kennung" type="varchar" />
> </field>
> <field name="rechte"
> type="RechteData" collection="collection">
> <sql many-key="benutzerId" />
> </field>
> </class>
>
>
> <class name="RechteData"
> identity="id" key-generator="MAX" >
> <map-to table="rechte" />
> <field name="id" type="integer">
> <sql name="id" type="integer" />
> </field>
> <field name="benutzer"
> type="BenutzerData"
> required="true">
> <sql name="benutzerId" />
> </field>
> <field name="nole"
> type="NoleData"
> collection="collection">
> <sql many-key="rechteId" />
> </field>
> </class>
>
> <class name="NoleData"
> identity="id" key-generator="MAX" >
> <map-to table="nole" />
> <field name="id" type="integer">
> <sql name="id" type="integer" />
> </field>
> <field name="nole"
> type="RechteData"
> required="true">
> <sql name="rechteId" />
> </field>
> </class>
>-------------------------------------------------------------------
>
>MySql: 4.1
>Castor: 0.9.6
>
>Thanks
>Marco
>
>Arcor-DSL: die echte Flatrate f�r alle Bandbreiten. Jetzt ohne
>Einrichtungspreis
>einsteigen oder wechseln. Arcor-DSL ist in vielen Anschlussgebieten verf�gbar.
>http://www.arcor.de/home/redir.php/emf-dsl-1
>
>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user