Really what I want to do is select all the Customers which relate to a client. They are related through the Orders table.
So usually the query would simply be
Code:
SELECT Customer.* FROM Order, Customer where Order.client_id = 100 AND Order.customer_id = Customer.customer_id
In the Example that JT gave, i understood most of it. The problem was with the join.
When he uses
ct.orders, i dont understand where the ct.orders value is or what its meant to be.
This is what i tried.
Code:
List customers = session.createSQLQuery("SELECT {ct.*} FROM Order odr, Customer ct WHERE odr.client_id = 1 AND ord.customer_id = ct.customer_id")
.addEntity("ct", Customer.class)
.addJoin("odr", "ct.orders")
.list();
If you could tell me what ct.orders is and what it might relate to or how this problem would be fixed, id really appreciate it
Thanks.