-->
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.  [ 4 posts ] 
Author Message
 Post subject: Traversing results returned in many-to-one relationship
PostPosted: Tue Aug 03, 2004 9:48 am 
Newbie

Joined: Tue Aug 03, 2004 8:37 am
Posts: 3
Hi all,

I'm doing a simple query joining 2 tables with a many-to-one relationship.
The query is
"from Employee e join e.dept d where d.dept_id=?". I'm using Spring dao HibernateDaoSupport to get the results and the results are returned in a List.

I've become a bit clueless how to traverse this list. The structure of the list looks like this.

List -> Object[0] -> Employee
-> Dept
-> Object[1] -> Employee
-> Dept
.
.
.
.
-> Object[n] -> Employee
-> Dept

My question is, how can I traverse to the Employee and Dept objects?

Thanks for you help in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 03, 2004 9:49 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Use a select clause and start reading the documentation about HQL.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 03, 2004 10:01 am 
Newbie

Joined: Tue Aug 03, 2004 8:37 am
Posts: 3
Thanks christian. Got it! right on page 149 of "Hibernate: A Developer's Note Book"


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 03, 2004 10:48 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Note that this book has many many errors and you should always check with the Hibernate reference documentation.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.