"many-to-one" within component problem NHibernate -


With the following mapping, BillingAuder. The country is mapped correctly but the shipping address. Country is always zero. Maybe it's due to the name of similar properties? But they are different objects ... How to fix any idea? Go ahead.

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Hibernate-mapping xmlns = "vase: nibinet-mapping -2.2" assembly = "capsenet.exe QuickOffice.Models" namespace = "KapsNet.QuickOffice.Dto" & gt; & Lt; Class name = "command" table = "` command` "& gt; & Lt; Id name = "id" type = "System.Int32" column = "ID" & gt; & Lt; Generator class = "identity" /> & Lt; / Id & gt; & Lt; Property Name = "CreateDate" column = "CreateDate" type = "System.DateTime" not-null = "true" /> & Lt; Property Name = "ClientCentid IDID" column = "ClientContident IDID" type = "System.INT 32" NOT-NULL = "true" /> & Lt; Component name = "billingadderer" class = "address information" & gt; & Lt; Property Name = "Address" column = "billingadditional" type = "system.string" no-null = "incorrect" length = "255" /> & Lt; Property name = "zipcode" column = "billingzip code" type = "system.string" no-null = "wrong" length = "50" /> & Lt; Property name = "city" column = "billing ct" type = "system.string" no-null = "wrong" length = "50" /> & Lt; Property Name = "CountryID" column = "BillingContent ID" type = "System.Int32" no-null = "true" /> & Lt; Property name = "phone" column = "billingphone" type = "system.string" no-null = "wrong" length = "50" /> & Lt; Many-to-one name = "country" column = "billingcountry id" category = "country" update = "0" insert = "0" /> & Lt; / Component & gt; & Lt; Component name = "shipping address" class = "AddressInfo" & gt; & Lt; Property Name = "Address" column = "shipping address" type = "System.String" no-null = "false" length = "255" /> & Lt; Property name = "zipcode" column = "shipping zipcode" type = "system.string" no-null = "false" length = "50" /> & Lt; Property Name = "City" column = "shippingcity" type = "System.String" no-null = "false" length = "50" /> & Lt; Property Name = "CountryID" column = "shipping countyID" type = "System.Int32" no-null = "true" /> & Lt; Property Name = "Phone" column = "shippingphone" type = "System.String" not-null = "false" length = "50" /> & Lt; Multiple-to-one name = "country" column = "shipping county id" class = "country" update = "0" = "0" /> & Lt; / Component & gt; & Lt; Multiple-to-One Name = "Client Contact" column = "Client Content IDID" class = "Client Contact" Update = "0" = "0" /> & Lt; Bag name = "OrderItemList" table = "OrderItem" inverted = "true" lazy = "true" cascade = "delete" & gt; & Lt; Major column = "order id" /> & Lt; One-to-many classes = "order automation" /> & Lt; / Bag & gt; & Lt; / Square & gt; & Lt; / Hibernate-mapping & gt;  

You must remove CountryID from the mapping for billing and shipping addresses because it was previously It is defined by the mapping in addition to this in many relationships in the country. If all the components of the component are zero then the component will be zero. Therefore, if all shipping address fields are zero then the shipping address component will be zero.


Comments