I have 2 classes.
 
The first class contains a collection of the second class.
I want the collection is sorted but, when I return the collection, I have an error "Failed to lazily initialize a collection"
 
My mapping is :
 
<class name="Class1" table="table1">
    ...
    <set role="child" lazy="true" cascade="save-update" sort="natural" >
        <key type="int" column="columnName"/>
        <one-to-many class="Class2"/>
    </set>
    ..
</class>
...
 
and My java code is :
 
public Class1() {
    ..
    child = new java.util.TreeSet();
    .
}
 

Laurent FLEURIOT | Ingénieur Études et Développement
Chemin de Saint Lambert - Actiburo 1 Bâtiment A - 13400 Aubagne
Tél : +33 4 91 87 84 03 - Fax : +33 4 91 87 81 09 - Mobile : +33 6 22 05 82 74

www.cosmosbay.com
 

<<cosmosbay.gif>>

Reply via email to