I'm trying to find the "cleanest" way of sorting by the other end of a one to one association. What I have so far is as follows;
User -(one-to-many)->subscription-(one-to-one)->feedDetails
What I would like to do is get all of the subscription objects for a user sorted by the title field of feedDetails.
In JDBC Prepared statement terms it would be something like;
Code:
select s.*
from subscriptions s, feeddetails f
where s.user_id = ?
and s.feed_id = f.feed_id
order by f.title
Is there a way to map this into the order-by attribute of a collection in a mapping file?, or should I just use the SQL and a SQLQuery object?
Hibernate version:
3.1.2
Mapping documents:
Under construction
Code between sessionFactory.openSession() and session.close():
Name and version of the database you are using:
MySQL 3.2.3