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.  [ 5 posts ] 
Author Message
 Post subject: Map to different collection based on colunm
PostPosted: Thu Jun 04, 2009 5:10 pm 
Newbie

Joined: Thu Jul 31, 2008 9:54 am
Posts: 4
I have a table like:
Code:
                          `Id`             INT(11) NOT NULL auto_increment,
                          `stand_Id`       INT(11) NOT NULL               ,
                          `CPOX` TINYINT(1) DEFAULT NULL                  ,

Id is a PK/stand_id is an FK
What i am wondering is, with NHibernate, is it possible to map all rows with CPOX = 1 to a different collection than when CPOX = 0? i haven't found a way, but i think it might be possible with either some voodoo magic polymorphism or possibly a discriminator. Not sure, just looking to know if it is possible and what i should be trying to use. Thanks!


Top
 Profile  
 
 Post subject: Re: Map to different collection based on colunm
PostPosted: Fri Jun 05, 2009 1:26 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Have you tried:

<bag (or set, map, list,...) name="CPOX0"...... where="CPOX=0"> ....</bag>
<bag (or set, map, list,...) name="CPOX1"...... where="CPOX=0"> ....</bag>

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Re: Map to different collection based on colunm
PostPosted: Fri Jun 05, 2009 7:49 am 
Newbie

Joined: Thu Jul 31, 2008 9:54 am
Posts: 4
Oh man thanks! I'm retarded i didn't even THINK about doing that. Thanks so much =D
-- as an aside i wanted to rate your anwser but i can't figure out how, wheres the button/link for that?


Top
 Profile  
 
 Post subject: Re: Map to different collection based on colunm
PostPosted: Fri Jun 05, 2009 8:00 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Maybe the rating stuff was removed with the new version of the forum software ...

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Re: Map to different collection based on colunm
PostPosted: Fri Jun 05, 2009 8:40 am 
Newbie

Joined: Thu Jul 31, 2008 9:54 am
Posts: 4
Thats a shame. But thank you again! Worked like a charm.


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