-->
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: Can a Collection map to a field as opposed to a property?
PostPosted: Fri May 27, 2005 3:11 am 
Newbie

Joined: Sun May 15, 2005 11:39 pm
Posts: 17
Location: Australia
Hi,

Can someone please tell me if a collection can map to a field as opposed to a property? I've had a look through the doco but can't put my fineger on it.


eg, I'm tyring to do the following

.Net
Code:
private IList      _ordersNH;


hbm.xml

Code:
   <bag   name="_ordersNH" inverse="true" lazy="true">
      <key column="cLITM"/>
      <one-to-many class="OPWLibrary.clsOrder,OPWLibrary"/>
   </bag>
   


Thanks very much in advance,



Damien Sawyer


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2005 4:01 am 
Beginner
Beginner

Joined: Thu May 12, 2005 3:41 am
Posts: 24
Location: London, UK
Yes. The documentation isn't yet complete, but the access attribute applies to collection mappings just like for properties. So, in your mapping file, add access="field" to the <bag> element. For more details see the discussion on Access Strategy at http://nhibernate.sourceforge.net/nh-docs/en/html/chunk/ch03.html#mapping-declaration-property.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2005 5:20 am 
Newbie

Joined: Sun May 15, 2005 11:39 pm
Posts: 17
Location: Australia
Thanks Bill,

That worked a treat :-)


DS


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.