hi there,
I am using 2.1.1
I use this mapping:
Code:
<class name="de.form4.catalog.entities.Catalog" table="KAT_CATALOG">
<id name="id" column="ID">
<generator class="increment"/>
</id>
...
<list name="doublePageList" table="KAT_CATALOG_DOUBLEPAGE">
<key>
<column name="CATALOG_ID" not-null="true"/>
</key>
<index column="I"/>
<many-to-many class="de.form4.catalog.entities.DoublePage">
<column name="DOUBLEPAGE_ID" not-null="true"/>
</many-to-many>
</list>
</class>
I use this query:
Code:
SELECT dp
FROM de.form4.catalog.entities.Catalog AS c
JOIN c.doublePageList AS dp
WHERE c.id = 2
I see this in the hibernate debug:
Code:
222740 [DEBUG] hibernate.SQL (getPreparedStatement.223) - select doublepage2_.ID as x0_0_, doublepage2_.LEFTLABEL as x1
_0_, doublepage2_.RIGHTLABEL as x2_0_ from KAT_CATALOG catalog0_, KAT_CATALOG_DOUBLEPAGE doublepage1_, KAT_DOUBLEPAGE do
ublepage2_ where catalog0_.ID=doublepage1_.CATALOG_ID and doublepage1_.DOUBLEPAGE_ID=doublepage2_.ID and ((catalog0_.ID=
2 ))
222740 [DEBUG] impl.BatcherImpl (getPreparedStatement.227) - preparing statement
223461 [DEBUG] loader.Loader (doQuery.196) - processing result set
223461 [DEBUG] loader.Loader (getRow.404) - result row:
223502 [DEBUG] type.LongType (nullSafeGet.68) - returning '14' as column: x0_0_
223502 [DEBUG] type.StringType (nullSafeGet.68) - returning '1/10' as column: x1_0_
223502 [DEBUG] type.StringType (nullSafeGet.68) - returning '1/11' as column: x2_0_
223512 [DEBUG] loader.Loader (getRow.404) - result row:
223512 [DEBUG] type.LongType (nullSafeGet.68) - returning '15' as column: x0_0_
223512 [DEBUG] type.StringType (nullSafeGet.68) - returning '11/11/55' as column: x1_0_
223512 [DEBUG] type.StringType (nullSafeGet.68) - returning '11/11/56' as column: x2_0_
223512 [DEBUG] loader.Loader (getRow.404) - result row:
223512 [DEBUG] type.LongType (nullSafeGet.68) - returning '13' as column: x0_0_
223512 [DEBUG] type.StringType (nullSafeGet.68) - returning '2' as column: x1_0_
223522 [DEBUG] type.StringType (nullSafeGet.68) - returning '3' as column: x2_0_
223522 [DEBUG] loader.Loader (getRow.404) - result row:
223522 [DEBUG] type.LongType (nullSafeGet.68) - returning '12' as column: x0_0_
223522 [DEBUG] type.StringType (nullSafeGet.64) - returning null as column: x1_0_
223522 [DEBUG] type.StringType (nullSafeGet.68) - returning '1' as column: x2_0_
223522 [DEBUG] loader.Loader (getRow.404) - result row:
223522 [DEBUG] type.LongType (nullSafeGet.68) - returning '16' as column: x0_0_
223522 [DEBUG] type.StringType (nullSafeGet.68) - returning '1/5' as column: x1_0_
223532 [DEBUG] type.StringType (nullSafeGet.68) - returning '1/6' as column: x2_0_
223532 [DEBUG] loader.Loader (doQuery.225) - done processing result set (5 rows)
the problem is:
the order of these objects is random. obviously the index column is not read. I probably can understand this in a manual query, but the same happens when I do:
Code:
Catalog cat = session.load(Catalog.class, new Integer(2));
cat.getDoublePageList();
here too, I get a random order, although the debug shows, that the index column is read.
my question:
How can I get an ordered list from a HQL query ?
thanx a lot in advance for any hints
:olliX