Ordering by a composite object, as the subject says, produces invalid SQL. Using the following query,

return getSession().createQuery("from NewOrder as no where no.orderId.district.districtId.d_id=?" +
               " and no.orderId.district.districtId.warehouse=?" +
               " order by no.orderId asc")
               .setInteger(0, districtId)
               .setInteger(1, warehouseId)
               .setFetchSize(2)
               .iterate();

produces an ORDER BY clause that looks like this:

order by (neworder0_.no_w_id, neworder0_.no_d_id, neworder0_.no_o_id) asc

which is obviously invalid (though it would work fine if the parentheses were not there!). I realize that queries against composites aren't really supported right now, but I figured this should at least throw an exception instead of produce an invalid query. I am very interested in working on developing composite support for Hibernate. However, before I got deep into looking at the problem, I wanted to ask the Hibernate developer community about why support for it has not been included in the past and whether such support would even be considered. What are the design decisions against it, et cetera. I'm new to Hibernate development and would really appreciate any insight that could be offered into both this problem and the problem of HQL composite ID support in general.

Thank you,
Bjorn Townsend


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to