I am getting duplicate entries when I am using lazy loading for a
collection. It only happens when I add all the items to the arraylist. What
is the best way to model lazy loading when the collection needs to be
sorted?
1--- N
WebResource ------> FormData.
Here is my implementation and mapping file.
Class WebResource {
:
ArrayList formData = new ArrayList();
public void setFormData(Collection formData) {
this.formData.clear();
if ( formData == null ) return;
this.formData.addAll(formData);
final Iterator iter = this.formData.iterator();
while(iter.hasNext() ) {
FormData f = (FormData) iter.next();
f.setWebResource(this);
}
java.util.Collections.sort(this.formData);
}
<class name="com.opendemand.jdo.WebResource" auto-complete="false"
identity="webResourceId" key-generator="keygen"
depends="com.opendemand.jdo.UserScenario">
<field name="formData" type="com.opendemand.jdo.FormData"
required="false" direct="false" transient="false" collection="collection"
lazy="true">
<sql many-key="web_resource_id" dirty="ignore" />
</field>
</class>
Steve
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------