I have entity Customer, Order, Line Item, Status, Currency These entities has one way relationship wither entities.
Customer has Order entity and this is One to one relation ship and it is one way relation ship from Customer to Order. (Customer has One Order)
Order has Line item entity and this is One to one relation ship and it is one way relation ship from Order to Line Item. (Order has one Line Item)
Order has Currency Entity and this is Many to One relation ship and it is also one way relation ship from Order to Currency (Many Order has one Currency)
Customer has Status Entity and this is Many to One relation ship and it is also one way relation ship from Customer to Status (Many Customer has one Status)
SELECT DISTINCT customer,1 FROM Customer customer RIGHT OUTER JOIN customer.order order JOIN order.currency as currency Where order.id = :ORDER_ID.
This above query generates 3 queries behind the scene. Could anybody help on how to write query that gets Customer,Order,LineItem,Currency,Status in single HQL.
|