<?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" > <class name="StaticData.Product, StaticDataLibrary" table="tbl_EspadaProduct" lazy="false"> <id name="Id" column="Id" type="string"> <generator class="assigned" /> </id> <property name="MarketId" column="MarketIdFk" /> <property name="DisplayName" column="DisplayName" /> <property name="SubMarket" column="SubMarket" /> <bag name="OrderTypes" table="tbl_EspadaSyntheticProductTypeLnk" lazy="false" > <key column="Type" property-ref="SubMarket"/> <many-to-many class="StaticData.OrderType, StaticDataLibrary" column="ProductType" lazy="false"></many-to-many> </bag>
</class> </hibernate-mapping>
which causes a collection is not associated with any session. However changing property-ref to foreign-key prevent the error, but generates the wrong sql. Id is used as the parameter rather than SubMarket.
Thanks Rakesh
|