-->
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: Filtered Association
PostPosted: Thu Sep 15, 2005 5:00 am 
Newbie

Joined: Mon Aug 08, 2005 4:16 pm
Posts: 15
Hi,

Is there anyway I can do filtered associations in Hibernate. For example, if I have Department and Employee classes, can I have a one-to-many bi-directional association where the an instance of Department will contain only EMployee instances matching a certain criteria.

Ta
Abu Mariam


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 15, 2005 11:29 am 
Senior
Senior

Joined: Tue Feb 08, 2005 5:26 pm
Posts: 157
Location: Montréal, Québec - Canada
There is a Filter API in Hibernate.

You can create a criteria in your mapping file (in your case, on the association between Department and Employees). You then enable in your session and every query that you issue will be filtered.

You can even pass parameters to your filter.

Read documentation file at: http://www.hibernate.org/hib_docs/v3/re ... te-filters

Good luck.

_________________
Vincent Giguère
J2EE Developer


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 15, 2005 4:36 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
or the where attribute in the collection mapping

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 16, 2005 7:31 am 
Newbie

Joined: Mon Aug 08, 2005 4:16 pm
Posts: 15
Thanks very much. That was exactly what I wanted.


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.