I am moving a simple working demo from nhibernate to free space. My existing nhibernate mapping is as follows:
<?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="MoneyHibernate" namespace="MoneyHibernate"> <class name="Invoice" table="Invoices"> <id name="Id"> <generator class="guid"/> </id> <property name="Number"/> <property name="Customer"/> <property name="TotalValue" type="MoneyHibernate.MoneyCompositeUserType,MoneyHibernate"> <column name="TotalValue_Amount" not-null="true" /> <column name="TotalValue_Currency" length="3" not-null="true" /> </property> </class> </hibernate-mapping>
I tried to create an equlivilant ClassMap :
internal class InvoiceMap : ClassMap<Invoice> { public InvoiceMap() { Id(x => x.Id); Map(x => x.Customer); Map(x => x.Number); Map(x => x.TotalValue) .CustomType(typeof (MoneyCompositeUserType)) .Column("TotalValue_Amount") .Column("TotalValue_Currency"); } }
But I get the error:
---> NHibernate.MappingException: the property mapping has the wrong column number: MoneyHibernate.Invoice.TotalValue type: MoneyHibernate.MoneyCompositeUserType
So, I believe that declaring a column twice is not the right way to do this?
source share