-->
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.  [ 3 posts ] 
Author Message
 Post subject: one-to-many relations question
PostPosted: Wed May 26, 2004 8:39 pm 
Beginner
Beginner

Joined: Sun May 16, 2004 3:53 pm
Posts: 47
Location: Belo Horizonte, Brazil
I've posted a similar question, now, i'd like to ask a theorical question.
Suppose i have a table Organization with orgId (pk) and orgName as it's columns.
I also have a table Employee with empId (pk), empName and fk_orgId (foreign key to Organization).

Organization has 0..* Employees
Employees belons to 1 Organization

Is there a way i can have a method
Code:
private List emps;
...
public List getEmployees(){
   return emps;
}


inside Organization class, even if Organization doesn't map the attribute emps to the database (as it's the employees are the many part of the relation)???

Thanks,
ltcmelo


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 3:21 am 
Newbie

Joined: Wed May 12, 2004 5:12 pm
Posts: 8
Location: Frankfurt / Germany
I think you might be able to implement something like that with a query.
But nevertheless you should simply consider mapping the employees to the organization (with lazy=true so that you don't have any major performance impacts)


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 9:16 am 
Beginner
Beginner

Joined: Sun May 16, 2004 3:53 pm
Posts: 47
Location: Belo Horizonte, Brazil
I don't want to implement it as a query (as i said before), i'd like just to have the employees of a Organization already mapped to the specfic Organization object (using lazy load or not).

Pleas take a look at

http://forum.hibernate.org/posting.php? ... y&t=931247

where i pointed this problem with a real situation that i'm having (there are some code at this other topic).

Thanks,
ltcmelo


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