| Hibernate version:1.0.2 
 Mapping documents:
 test     (1)---------->subtest (N)
 test.hbm.xml:
 <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
 <class name="Entity.Test,Entity" table="Test" lazy="true">
 <composite-id>
 <key-property name="keyOne" column="keyOne" type="Int32"  />
 <key-property name="keyTwo" column="keyTwo" type="Int32"  />
 </composite-id>
 <property name="myproperty" column="myproperty" type="String"/>
 <property name="myint" column="myint" type="Int32"/>
 
 <bag name="SubTestList" cascade="save-update"  inverse="true"   lazy="true">
 <key>
 <column name="keyOne"/>
 <column name="keyTwo"/>
 </key>
 <one-to-many class="Entity.SubTest,Entity"/>
 </bag>
 </class>
 </hibernate-mapping>
 
 subtest.hbm.xml:
 <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
 <class name="Entity.SubTest,Entity" table="SubTest" lazy="true">
 <composite-id>
 <key-property name="keyOne" column="keyOne" type="Int32"  />
 <key-property name="keyTwo" column="keyTwo" type="Int32"  />
 <key-property name="keyThree" column="keyThree" type="Int32"  />
 </composite-id>
 
 <property name="mySubproperty" column="myproperty" type="String"/>
 
 <many-to-one name="Parent"  class="Entity.Test,Entity" insert="false" update="false">
 <column name="keyOne"/>
 <column name="keyTwo"/>
 </many-to-one>
 </class>
 </hibernate-mapping>
 
 Class: (ignore),
 and already override Equals() and GetHashCode().
 
 test code:
 public void test()
 {
 // already add data:
 //test(1,1"test",15)
 //subtest(1,1,1,"sub1")
 //subtest(1,1,2,"sub2")
 SubTest sub = session.Get(typeof(SubTest), new SubTest(1, 1, 1)) as SubTest;
 
 Assert.IsNotNull(sub .Parent);
 Assert.IsTrue(sub .Parent.myint == 15);
 }
 
 
 run test throw exception:
 
 test: NHibernate.HibernateException : Creating a proxy instance failed
 ----> System.MissingMethodException : Constructor on type 'CProxyTypeTestSystem_INHibernateProxy_ISerializable2' not found.
 
 why? I don't know this exception,
 please,help me,thank you
 
 
 |