-->
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.  [ 2 posts ] 
Author Message
 Post subject: Retrieving specific row in one-to-many relationship
PostPosted: Thu Jun 28, 2007 3:27 pm 
Newbie

Joined: Tue Jun 19, 2007 11:34 am
Posts: 2
I have a 1st class named ProgramsBasicInfo with 2 parameters:
    int ID;
    IList ExtendedInfo;

My mapping looks something like this :
Code:
<class name="ProgramsBasicInfo" table="...">
    <id name="ID" column="id">
      <generator class="assigned" />
    </id>
    <bag name="ExtendedInfo">
      <key column="id"/>
      <one-to-many class="ProgramsExtendedInfo"/>
    </bag>
  </class>


In my ProgramsExtendedInfo, I have 3 parameters:
    int ID;
    string Language;
    string OfficialTitle;

Mapping:
Code:
<class name="ProgramsExtendedInfo" table="...">
    <id name="ID" column="id">
      <generator class="assigned" />
    </id>
    <property name="Language" column="Language"/>
    <property name="OfficialTitle" column="OfficialTitle"/>
  </class>


Every ProgramsBasicInfo is associated to 2 ProgramsExtendedInfo - 1 for each language (english and french). Depending on language selection, I'd like to be able to retrieve all ProgramsBasicInfo entries, but only those for that language. But I can't do a where clause on a ProgramsBasicInfo.ExtendedInfo.Language.

Can anyone point me to a solution for this please.

Thank you for your help
Olivier Dupuis


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 28, 2007 3:40 pm 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
What you need may be filters. See here:
http://www.hibernate.org/hib_docs/nhibe ... lters.html

_________________
Karl Chu


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