-->
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: NHibernate Mapping Question
PostPosted: Tue Aug 02, 2005 1:09 am 
Hello,

I am new to NHibernate. I am trying to map entries in my symbol table back to my members class. Since the ID of the symbol table entry is being stored as a column in the members table, a one-to-one mapping does not appear to work. What I would like to do is achieve something like:

Member objMember = objSession.Find(typeof(Member), 0);
Symbol objSymbolMale = objSession.Find(<male symbol>);

objMember.Gender = objSymbolMale;

objSession.Update(objMember);

Or something to that affect. Any ideas?

Thanks,
Chris


Top
  
 
 Post subject:
PostPosted: Tue Aug 02, 2005 3:51 am 
Regular
Regular

Joined: Mon Jul 18, 2005 4:10 am
Posts: 92
Location: Poland
I think you need many-to-one relation:

<many-to-one name="Gender" column="IdSymbol" class="Symbol" />

_________________
michal


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 02, 2005 4:51 am 
Perfect! I'm not sure why my feeble brain didn't make that connection, but it makes since now that I look at it. Thanks for the quick response!

Chris


Top
  
 
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.