I delete attribute unsave-value but the mistake persists and I replace set by bag tag in region xml mapping file.
my new hbm.xml files are:
[code]
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="NHDomainModel.Region, NHDomainModel" table="REGIONS">
<id name="RegionId" column="REGION_ID" type="Int32" unsaved-value="0" >
<generator class="sequence">
<param name="sequence">REGION_SEQ</param>
</generator>
</id>
<property name="RegionName" column="REGION_NAME" type="String"/>
<bag name="Countries" cascade="all" lazy="false" inverse="true">
<key column="REGION_ID" />
<one-to-many class="NHDomainModel.Country, NHDomainModel" />
</bag>
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="NHDomainModel.Country, NHDomainModel" table="COUNTRIES">
<id name="CountryId" column="COUNTRY_ID">
<generator class="assigned" />
</id>
<property name="CountryName" column="COUNTRY_NAME" />
<many-to-one name="Region" column="REGION_ID" class="NHDomainModel.Region, NHDomainModel" />
</class>
</hibernate-mapping>
[/code]
|