-->
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: Composit id creation
PostPosted: Mon Jun 27, 2005 3:47 am 
Beginner
Beginner

Joined: Thu Jun 09, 2005 3:18 am
Posts: 34
Location: India
Hi all

I am having tables
Emp (empno, ename, designation, salary, deptid)
Dept(deptid, dname,location)

I am trying to create a composite id for emp mapping file

here is my 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="Emp" table="Administrator.EMPP">


<composite-id>
<key-property name="empno" column="EMPNO"/>
<key-property name="dept_id" column="dept_id"/>

</composite-id>


<property name="ename" column="ENAME" type="string"/>
<property name="designation" column="DESIGNATION" type="string"/>
<property name="salary" column="SALARY" type="java.lang.Float"/>



</class>

</hibernate-mapping>


I am throwing the follwing error

12:57:45,444 ERROR XMLHelper:48 - Error parsing XML: XML InputStream(26) The content of elements must consist of well-formed character data or markup.
12:57:45,454 ERROR Configuration:296 - Could not configure datastore from input stream
org.dom4j.DocumentException: Error on line 26 of document : The content of elements must consist of well-formed character data or markup. Nested exception: The content of elements must consist of well-formed character data or markup.
at org.dom4j.io.SAXReader.read(SAXReader.java:355)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 27, 2005 8:33 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Your XML-File is f***ed up. I suspect some character-encoding issues or something.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 05, 2005 10:01 am 
Beginner
Beginner

Joined: Sun Aug 22, 2004 5:32 pm
Posts: 40
I believe your composite-id has to have a class and name:

<composite-id name="someName" class="package.ClassName">
<key-property name="empno" column="EMPNO"/>
<key-property name="dept_id" column="dept_id"/>

</composite-id>

The class would be a bean containing the properties empno and dept_id.

_________________
Scott
www.HikeHaven.com


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.