You must specify the class used. By default, OJB will use RemovalAwareCollection, that 
will delete values...
Just put:

 <collection-descriptor
         name="monitors"
         element-class-ref="com.contego.arx.domain.Monitor"
         collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
         auto-retrieve="true"
         auto-update="false"
     auto-delete="false"
         indirection-table="ccp_monitor_package_monitor">
         <fk-pointing-to-this-class column="monitor_package_id"/>
         <fk-pointing-to-element-class column="monitor_id"/>
 </collection-descriptor>

 and then this should work fine.


Edson Richter

  ----- Original Message ----- 
  From: Chris Widhelm 
  To: OJB Users List 
  Sent: Monday, September 08, 2003 11:13 AM
  Subject: Re: non-decomposed m:n mapping deleting incorrectly


  Does anyone have any ideas on this?

  It just seems odd that by removing an item from a collection that it
  performs a delete on the object that is in the collection.

  Thanks,

  Chris

  ----- Original Message ----- 
  From: "Chris Widhelm" <[EMAIL PROTECTED]>
  To: "OJB Users List" <[EMAIL PROTECTED]>
  Sent: Thursday, September 04, 2003 4:21 PM
  Subject: non-decomposed m:n mapping deleting incorrectly


  I have a non-decomposed m:n mapping set up with an inderection table and for
  some reason when I call Collection.remove( Object ) it is deleting not only
  the mapping in the inderection table, but also the object that is mapped by
  the inderection table.

  How do I stop this behavior?

  See my configuration below:

  ===================================
  <class-descriptor class="com.contego.arx.domain.Monitor"
  table="ccp_monitor">
      <field-descriptor
          name="id"
          column="id"
          jdbc-type="INTEGER"
          primarykey="true"
          autoincrement="true"/>
      <field-descriptor
          name="monitorName"
          column="monitor_name"
          jdbc-type="VARCHAR"/>
      <field-descriptor
          name="displayName"
          column="display_name"
          jdbc-type="VARCHAR"/>
      <field-descriptor
          name="description"
          column="description"
          jdbc-type="VARCHAR"/>
      <field-descriptor
          name="configurationString"
          column="configuration_string"
          jdbc-type="VARCHAR"/>
      <field-descriptor
          name="url"
          column="url"
          jdbc-type="VARCHAR"/>
  </class-descriptor>

  <class-descriptor class="com.contego.arx.domain.MonitorPackage"
  table="ccp_monitor_package">
      <field-descriptor
          name="id"
          column="id"
          jdbc-type="INTEGER"
          primarykey="true"
          autoincrement="true"/>
      <field-descriptor
          name="packageName"
          column="package_name"
          jdbc-type="VARCHAR"/>
      <field-descriptor
          name="description"
          column="description"
          jdbc-type="VARCHAR"/>
   <collection-descriptor
           name="monitors"
           element-class-ref="com.contego.arx.domain.Monitor"
           auto-retrieve="true"
           auto-update="false"
       auto-delete="false"
           indirection-table="ccp_monitor_package_monitor">
           <fk-pointing-to-this-class column="monitor_package_id"/>
           <fk-pointing-to-element-class column="monitor_id"/>
   </collection-descriptor>
  </class-descriptor>

  ===================================


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



  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.515 / Virus Database: 313 - Release Date: 1/9/2003

Reply via email to