Hello OJB users!

(repository and objects listed at the end, problem description follows here)

I read some emails in the mailing archives but many of them focus on the delete Problem in non-decomposed m:n Mappings. I use manual decomposition because I add extra information to my intermediary table so I need a association class. I used the example for manual decomposition in the "basic techniques" documentation on the ojb homepage by Thomas Mahler, Jakob Braeuchli and Armin Waibel. I have no problem to add (store) my association class in the intermediary table, but when I try to remove (delete) an entry, it does not work. I use broker.delete(object), not broker.deleteByQuery(object):

public void remove(ExhibitorAndBooth object) {
PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
       broker.beginTransaction();
       broker.delete(object);
       broker.commitTransaction();
       broker.close();
}

I get no exceptions, everything seems to be fine, but the entry is not deleted.

Is there any solution/trick? Does an update on 1.0.3 fix this? I use cocoon 2.1.7, it has ojb1.0.1 included, I would have to recompile my cocoon with the new ojb version. Well, thanks for any suggestions or ideas. My repository and objects are listed below.

Here are the entries of my repository for the objects Exhibitor and Booth with their m:n relation and the association class ExhibitorAndBooth:

##############
repository.xml

<class-descriptor class="com.mediaconcept.fairmanager.exhibitor.beans.Exhibitor" table="EXHIBITORS"> <field-descriptor name="id" column="EX_ID" jdbc-type="INTEGER" primarykey="true" autoincrement="true" nullable="false" default-fetch="true" sequence-name="exhibitors_ex_id_seq" />
       ...

<collection-descriptor name="exhibitorsAndBooths" element-class-ref="com.myPackage.ExhibitorAndBooth">
           <inverse-foreignkey field-ref="exhibitor_id"/>
       </collection-descriptor>
   </class-descriptor>
<class-descriptor class="com.mypackage.Booth" table="BOOTHS"> <field-descriptor name="id" column="BO_ID" jdbc-type="INTEGER" primarykey="true" autoincrement="true" nullable="false" default-fetch="true" sequence-name="booths_bo_id_seq" />
      ...
<collection-descriptor name="exhibitorsAndBooths" element-class-ref="com.mypackage.ExhibitorAndBooth">
           <inverse-foreignkey field-ref="booth_id"/>
       </collection-descriptor>
   </class-descriptor>

<class-descriptor class="com.mypackage.ExhibitorAndBooth" table="EXHIBITORSANDBOOTHS"> <field-descriptor name="exhibitor_id" column="EX_ID" jdbc-type="INTEGER" primarykey="true" /> <field-descriptor name="booth_id" column="BO_ID" jdbc-type="INTEGER" primarykey="true" /> <field-descriptor name="hierarchy" column="EB_HIERARCHY" jdbc-type="INTEGER" /> <reference-descriptor name="exhibitor" class-ref="com.myPackage.Exhibitor">
           <foreignkey field-ref="exhibitor_id" />
       </reference-descriptor>
       <reference-descriptor name="booth" class-ref="com.myPackage.Booth">
           <foreignkey field-ref="booth_id" />
       </reference-descriptor>
</class-descriptor>

###################
The classes:

public class Exhibitor {

   private int id;
   ...
private Collection exhibitorsAndBooths = new ArrayList();
   ...
  //getters/setters
}

public class Booth {

   private int id;
  ...

   private Collection exhibitorsAndBooths = new ArrayList();
  ...
  //getters/setters
}

public class ExhibitorAndBooth {

   private int exhibitor_id;
   private int booth_id;
private int hierarchy; private Exhibitor exhibitor;
   private Booth booth;
  ...
  //getters/setters
}

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

Reply via email to