Hi,
I'm using NHibernate-1.2.0.Alpha1, MS SQL Express 2005
I'm trying to implement a many-to-many relationship between a Program and a Plan (a Program has many plans and a Plan can be in more then a Program).
The mapping file for Program object is:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="TestHibernate.ProgramObject, TestHibernate" table="iauprg">
<id name="Id" column="prgidn" type="int">
<generator class="identity"/>
</id>
<property name="Interval" column="prgint"/>
<property name="Owner" column="prgown"/>
<set name="Plans" table="iauprg2iaupln" lazy="true" cascade="save-update" inverse="true">
<key column="prgidn"/>
<many-to-many class="TestHibernate.PlanObject, TestHibernate" column="plnidn"/>
</set>
</class>
</hibernate-mapping>
Similar for Plan object except the inverse attribute.
Code between sessionFactory.openSession() and session.close():
tx = session.BeginTransaction();
ProgramObject program = new ProgramObject();
IList programs = session.CreateQuery("FROM ProgramObject").List();
programs.Add(program);
this.treeList1.DataSource = programs;
The error is: Invalid mapping information specified for type TestHibernate.ProgramObject, check your mapping file for property type mismatches.
The mapping looks fine and if a comment the set tag from mapping file the information is displayed in the treelist correctly.
Can you tell me what am I doing wrong?
Thanks
|