This may be my problem. The objects are actually created by struts on
form submition. I mearly replace the ArrayList with the new one created.
I know the timestamps won't match, but that shouldn't matter. Shouldn't
it delete all previous ones, and recreate new ones ?
ie
//receive the form
SiteCareForm sForm = (SiteCareForm) form;
//retrive previous castor version of the form
SiteCareForm s2Form = session.getAttribute("myForm);
s2Form.setDates(sForm.getDates);
update(s2Form);
// then store form to session
session.setAttribute(s2Form);
?
>>> [EMAIL PROTECTED] 06/21/05 2:16 PM >>>
Eric,
can you please show me a code fragment that shows us how you are
calling
Castor to e.g. delete the objects and add some others from/to the
collection ?
Thanks
Werner
Eric Anderson wrote:
> 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]
> -------------------------------------------------
>
>
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------