These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: many-to-many invalid mapping problem
PostPosted: Wed Jul 12, 2006 6:11 am 
Newbie

Joined: Wed Jul 12, 2006 5:57 am
Posts: 3
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.