I have a problem with a one to many relationship. I have one object that
has an arraylist (1:M). This is the problem.

The first time I save that object lets say with 10 objects in the
arraylist, it saves 10 rows. If I delete all objects in the arraylist
and add 3  do an update, I end up with 13 rows, not 3. If I reduce it to
0 and do an update, I end up with no rows (no matter how many I had in
there...).

Anyone know why? Here is my mapping file.

<class name="org.usiis.struts.SiteCareForm" identity="vaccineId">
        <map-to table="WWW_SITE_CARE"/>
        <cache-type type="count-limited"/>
        <field name="dateVaersSubmitted" type="date" ><sql
name="date_vaers_submitted" type="date" dirty="ignore"/></field>
        <field name="notes" type="string" ><sql name="notes" type="char"
dirty="ignore"/></field>
        <field name="permMedicalRec" type="string" ><sql
name="perm_medical_rec" type="char" dirty="ignore"/></field>
        <field name="recievedMedicalCare" type="string" ><sql
name="received_medical_care" type="char" dirty="ignore"/></field>
        <field name="treatmentDate" type="date" > <sql
name="treatment_date" type="date" dirty="ignore"/></field>
        <field name="vaccineId" type="integer" ><sql name="vaccine_id"
type="integer" dirty="ignore"/></field>
        <field name="vaersSubmitted" type="string" ><sql
name="vaers_submitted" type="char" dirty="ignore"/></field>
        
        <field name="dates" type="org.usiis.struts.SiteCareDatesForm"
collection="arraylist"> <sql many-key="vaccine_id"/>  </field>
        <field name="vaccine" type="org.usiis.struts.VaccinationForm">
<sql name="vaccine_id" dirty="ignore" read-only="true"/> </field>

 </class> 
  
<class name="org.usiis.struts.SiteCareDatesForm" identity="vaccineId Id
eventDate" depends="org.usiis.struts.SiteCareForm" >
        <map-to table="WWW_SITE_CARE_DATES"/>
        <cache-type type="count-limited"/>  
        <field name="eventDate" type="date"><sql name="event_date"
type="date" dirty="ignore"/></field>
        <field name="Id" type="integer"><sql name="ID"
type="integer"/></field>
        <field name="vaccineId" type="integer"><sql name="vaccine_id"
type="integer"/></field>
</class>

-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to