Hi Stephen,

Werner recently added collection="sortedset" (included with 1.0M1). I
don't know how it behaves together with lazy loading but it should be
the best option for you.

You may want to have a look at release-notes for a short description on
how to use it.

Regards
Ralf
Castor JDO, committer


Stephen Ince schrieb:
> 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]
> -------------------------------------------------

-- 

Syscon Ingenieurbüro für
Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
D-72127 Kusterdingen
Germany

Tel.   +49 7071 3690 52
Mobil: +49 173 9630135
Fax    +49 7071 3690 98

Email: [EMAIL PROTECTED]
Web:   www.syscon-world.de

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

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

Reply via email to