Hibernate version: Latest version
String[] names = {"a", "b"};
Class[] classes = {Item.class, CustomerItemPrice.class};
Query query = session.createSQLQuery("select {a.*},{b.*} from item a LEFT OUTER JOIN customer_re_itemprice b on a.item_id = b.item_id and customer_id=4", names, classes);
return query.list();
When I loop through the list it has an Array of objects. How can I get the Item and CustomerItemPrice from the Object.
Am I doing this the wrong way ? What are the best practices for joining 2 objects which does not have a relationship ? When do you use createSQLQuery ?
Thank you very much.
|