views:

194

answers:

1

My error message:

NHibernate.MappingException : broken column mapping for: ItemDetails.id of: NHibReg.Domain.RegDetail, type Int32 expects 1 columns, but 2 were mapped

I get this when I try to get a RegDetail row: How can I solve this?

Here is the RegDetail MAP:

<class name="RegDetail" table="******">

  <composite-id>
    <key-property name="RegistryNum" column="****" type="int"/>
    <key-property name="Sku" column="****" type="int"/>
  </composite-id> 

  <property name="QtyRequested" column="****" type="int"/>
  <one-to-one name="ItemDetails" class="Item"/>

</class>

Here is the Item MAP:

<class name="Item" table="Items">

  <id name="Sku" column="SKU" type="int"/>
  <property name="StyleDescrip" column="*****" type="String"/>

</class>
A: 

I'm going to say you should try to do a Join rather than One-to-One. Something like this: http://stackoverflow.com/questions/881168/fluent-nhibernate-map-2-tables-to-one-class.

I'm not sure how 1:1 could work with different keys in the two entities.

ZeroBugBounce
Tried it, I still get a similar error.
sunil

related questions