-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Native SQL join problem - joining child node
PostPosted: Mon Nov 26, 2007 11:46 am 
Newbie

Joined: Tue Aug 28, 2007 10:01 pm
Posts: 3
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.2

Mapping documents: refer to Java persistence with Hibernate

Code between sessionFactory.openSession() and session.close():
The following code is from "Java persistence with Hibernate" book, page 684.
Code:
session.createSQLQuery("select {i.*}, {u.*} from ITEM i" +
   " join USERS u on i.SELLER_ID = u.USER_ID " +
   " where u.USERNAME = :uname")
   .addEntity("i", Item.class)
   .addJoin("u", "i.seller")
   .setParameter("uname", "johndoe");


The code returns List<Object[]>, and each Object[] has two element - Item and User.
But as you see, the user is actually item.seller.
Why don't hibernate return just Item object which already include seller object?
What should I do for getting List<Item> object and each Item object include seller object?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 21, 2008 1:01 pm 
Newbie

Joined: Tue Nov 06, 2007 1:37 pm
Posts: 7
Did you ever figure this out? I'm having the same issue.

jensenkd


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

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.