drj wrote:
Code:
session.createQuery(
"SELECT b from Book b " +
"JOIN b.language l WHERE l.Direction = :direction " +
"JOIN b.author a WHERE a.id = :authorId ")
.setString("direction", "left-to-right")
.setInteger("authorId", authorId)
.list()
Justin
thanks for the reply, unfortunately things are a little more complicated. The 'Book' class is
not a 'top-level' table - it can only be accessed indirectly from the 'Author' class. The Book class models a legacy table which does not have an 'id' column - it has a multi-column unique key - which i don't know how to do using xdoclet tags.
But Book is really in a one-to-many relationship with Author - so i don't want to model it as a separate table.
If making 'Book' a top-level table is the only way to do this then i will either re-think the model or just explictly fetch each of the column values and construct the Book object as i iterate thru the results.
btw - i have not successfully used the 'select new Book(...)' syntax - hibernate runtime can't find the necessary constructor .