-->
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.  [ 3 posts ] 
Author Message
 Post subject: mapping error
PostPosted: Mon Aug 20, 2007 6:18 am 
Newbie

Joined: Mon Aug 20, 2007 5:18 am
Posts: 8
I am getting following error messages and I can use join
Duplicate collection role mapping com.co803.data.Member.books
Could not read mappings from resource: com/data/Member.hbm.xml
Association references unmapped class: com.data.Book

Any idea if you please...

This is my member mapping
<hibernate-mapping package="com.data">
<class name="Member" table="member">
<id name="no" type="java.lang.Integer">
<column name="no" />
<generator class="increment"></generator>
</id>
<set name="books" table="Book" inverse="false" >
<key>
<column name="id"></column>
</key>
<one-to-many class="Book" />
</set>
<property name="name" type="java.lang.String">
<column name="name" length="100" not-null="true" />
</property>
.
.
.
.

This is my member mapping
<hibernate-mapping package="com.data">
<class name="Book" table="book">
<id name="id" type="java.lang.Integer">
<column name="id" />
<generator class="increment"></generator>
</id>
<many-to-one name="member" column="no" not-null="true" />
<property name="name" type="java.lang.String">
<column name="name" not-null="true" />
</property>
.
.
.
.
This is my hibernate.cfg.xml
<mapping resource="com/data/Member.hbm.xml" />
<mapping resource="com/data/Book.hbm.xml" />


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 20, 2007 10:41 am 
Expert
Expert

Joined: Fri Jul 13, 2007 8:18 am
Posts: 370
Location: london
Don't map the book collection key to the ID of the book table. It should be a foreign key refering back to member, so call it member_id, say.


Top
 Profile  
 
 Post subject: ok thanks
PostPosted: Thu Aug 23, 2007 12:42 pm 
Newbie

Joined: Mon Aug 20, 2007 5:18 am
Posts: 8
it was mapping problem. I solved it...


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

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.