-->
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.  [ 5 posts ] 
Author Message
 Post subject: SAXParseException with many-to-one element
PostPosted: Sun Oct 26, 2003 9:06 pm 
Regular
Regular

Joined: Sun Oct 26, 2003 9:02 pm
Posts: 90
Hi

I'm using a many-to-one relationship with a table that has a composite id. So my xml mapping file has an entry like this:

<many-to-one name="itemClass" class="package.ItemClass">
<column name="class_id"/>
<column name="class_version"/>
</many-to-one>

When Hibernate parses the file it says that the attribute "type" is required for the element many-to-one. What value do I have to put in this attribute?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 26, 2003 9:31 pm 
Newbie

Joined: Mon Oct 20, 2003 3:03 pm
Posts: 13
can't tell - whole mapping file please...


Top
 Profile  
 
 Post subject: Mapping File
PostPosted: Sun Oct 26, 2003 10:19 pm 
Regular
Regular

Joined: Sun Oct 26, 2003 9:02 pm
Posts: 90
This is the mapping file

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

<class name="package.Item" table="jw_item">
<id name="id" column="id" type="big_decimal">
<generator class="hilo"/>
</id>
<many-to-one name="itemClass" class="package.ItemClass">
<column name="class_id"/>
<column name="class_version"/>
</many-to-one>
<many-to-one name="parent" column="parent_id" type="big_decimal" class="package.Item"/>
</class>

<class name="package.ItemClass" table="jw_class_def">
<composite-id>
<key-property name="id" column="id" type="big_decimal"/>
<key-property name="version" column="version" type="big_decimal"/>
</composite-id>
<many-to-one name="parent" class="package.ItemClass">
<column name="class_id"/>
<column name="class_version"/>
</many-to-one>
</class>

</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 26, 2003 10:26 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Code:
<many-to-one name="parent" column="parent_id" type="big_decimal" class="package.Item"/>


is broken. remove the type attribute.


Top
 Profile  
 
 Post subject: Thanks it worked!
PostPosted: Mon Oct 27, 2003 8:01 am 
Regular
Regular

Joined: Sun Oct 26, 2003 9:02 pm
Posts: 90
Thanks it worked!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.