-->
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: joining data from two tables (for lookups only)
PostPosted: Fri Mar 18, 2005 6:28 pm 
Newbie

Joined: Fri Mar 18, 2005 6:15 pm
Posts: 3
Location: New York
Hello!

I am using hibernate (version2) with oracle database.

I have a table Sites with columns site_id and site_name.
I also have a table UserSites with columns user_id, user_name, site_id (FK to Site table).

I defined a class for UserInfo and also mapped it as a hibernate object.

class UserSites {

int user_id
string user_name
int site_id
string site_name

}

I do not want to map table Sites as we only use it for lookups.

If I were to use plain sql, I would write the following query:

select user_id, user_name, u.site_id, site_name from Sites s, UserSites u where u.site_id = s.site_id.

How can I map my class UserSites so that it joins these two tables and populates site_name with the correct data? (without creating the mapping for table Sites)

Thanks!

_________________
-julia


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.