Hibernate Books

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: createSQLQuery return type
PostPosted: Wed Dec 08, 2004 4:17 am 
Newbie

Joined: Wed Dec 08, 2004 4:11 am
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.