-->
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.  [ 1 post ] 
Author Message
 Post subject: join selects
PostPosted: Fri Apr 29, 2005 9:03 am 
Newbie

Joined: Fri Apr 29, 2005 8:38 am
Posts: 1
Hi I've just started learning Hibernate on my own, and I think I already understand the basics.
I've seen how to map the tables to POJO's where you can access the properties of the resulting objects with set/get methods.
But there's something I haven´t been able to find: when you implement a select with joined tables.
For example the simple case:
select t.town_name, s.state_name, t.population from towns t, states s where t.state_id = s.id and t.population<5000

The first thing I've thought is to implement a select on object Town where population<5000 and then for each object obtained impement another select on object State where S.id = town.getState_id()

this is easy, but if the select were more complicated with many tables joined it would be a mess. I'm sure that somehow hibernate must automate this, but I haven´t seen any clear examples.
Can anyone give me a hint about this?

Thanks.


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.