That's because you have the USERID column mapped twice - one for the 
Address and another for the UserDetail property!

On Thursday, April 18, 2013 1:07:37 AM UTC+1, AlterWorld wrote:
>
> I am trying to change one-to-one mapping to many-to-one so that I can use 
> lazy load. I have seen many examples of it being implemented and I followed 
> the same pattern but I get the following error. 
>
> **Invalid index xx for this SqlParameterCollection with Count=xx.**
>
> I will appreciate any help/recommendation you can provide. 
>
> Sample mapping user: 
>
>     
> <class name="User" table="User" >
>     <id name="ID" type="guid">
>     <column name="USERID" />
>     <generator class="guid.comb" />
>     </id>
>       <many-to-one name="Address" class="Address" cascade=
> "all-delete-orphan" lazy="no-proxy" unique="true" column="USERID"/>
>     
>       <many-to-one name="UserDetail" class="UserDetail" cascade=
> "all-delete-orphan" lazy="no-proxy" unique="true" column="USERID"/>
>     
>     
>         <property name="Name" />
>     </class>
>
>
> Sample mapping address:
>
>     <class name="Address" table="Address" >
>     <!--Identity mapping-->
>     <id name="ID" type="guid">
>     <column name="USERID" />
>     <generator class="foreign">
>     <param name="property">User</param>
>     </generator>
>     </id>
>     
>      <one-to-one name="User" class="User" constrained="true"/>
>     </class>
>
>
>
> Sample mapping user detail:
>
>
>     <class name="Address" table="Address" >
>     <!--Identity mapping-->
>     <id name="ID" type="guid">
>     <column name="USERID" />
>     <generator class="foreign">
>     <param name="property">User</param>
>     </generator>
>     </id>
>     
>      <one-to-one name="User" class="User" constrained="true"/>
>     </class>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to