c# - NHibernate mapping bag with keys from property of a property -


i have following structure:

public class version {     public status status; }  public class status {     action action;     area area;      public ilist<version> versions }  public class action {     public int id; }  public class area {     public int id; } 

and map list of versions bag, might mapping wrong way. here parte of status.hbm.xml file maps list:

<bag name="versions" cascade="save-update" inverse="true" lazy="true" generic="true" order-by="num_version desc">   <key>     <column name="id_action"></column>     <column name="id_area"></column>   </key>   <one-to-many class="version" /> </bag> 

id_action , id_area foreign keys status, property of version. need reference status on bag mapping? how supposed map case?

thank you

i able find problem: mapping used on answer correct. however, needed inverse order of columns on mapping. because both keys (action , area) must in same order defined in mapping of status.hbm.xml file.

so, correction doing this:

<bag name="versions" cascade="save-update" inverse="true" lazy="true" generic="true" order-by="num_version desc">   <key>     <column name="id_area"></column>     <column name="id_action"></column>   </key>   <one-to-many class="version" /> </bag> 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -