-->
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.  [ 6 posts ] 
Author Message
 Post subject: Error in hbm.xml file
PostPosted: Wed May 30, 2007 12:39 am 
Newbie

Joined: Wed May 30, 2007 12:24 am
Posts: 4
Hi,
I am using the following mapping file, but is giving me exception .Could
anybody please help me in this issue.

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name = "com.Login" table="LOGIN">

<id name="id" type="long" column="ID" >
<generator class="assigned"/>
</id>

<property name="name">
<column name="NAME"/>
</property>

<property name="age">
<column name="AGE"/>
</property>

<property name="email">
<column name="EMAIL"/>
</property>
</class>
<sql-query name="selectAllEmployees_SP">
<return alias="emp" class="com.Login">
<return-property name="id" column="id"/>
<return-property name="name" column="name"/>
<return-property name="age" column="age"/>
<return-property name="email" column="email"/>
</return>
{ ? = call selectEvents() }
</sql-query>



</hibernate-mapping>

The Exception is

Caused by: org.xml.sax.SAXParseException: Element type "return-property" must be declared.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:334)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:393)


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 30, 2007 4:08 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

I didn't get error . can you tell me which stage exception raised. at mapping stage or querying stage.


Amila


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 30, 2007 4:11 am 
Newbie

Joined: Wed May 30, 2007 12:24 am
Posts: 4
at mapping stage


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 30, 2007 4:13 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

tell me your hibernate version ,java version and database

Amila


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 30, 2007 4:16 am 
Newbie

Joined: Wed May 30, 2007 12:24 am
Posts: 4
java- jdk1.5
oracle 9i
hibernate 3.0


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 01, 2007 7:23 pm 
Newbie

Joined: Fri Jun 01, 2007 7:03 pm
Posts: 3
I'm not sure if its causing your specific problem, but your property elements do not denote the type of the column/member. Try something like..
Code:
<property name="name">
  <column name="NAME" type="string"/>
</property>

And so forth for the other properties.

The exception you are getting seems to indicate that the XML parser does not recognize the return-property tag. I've never built SQL into my mappings, so I'm unfamiliar with the process, but it looks like the tag is undefined. If you are simply trying to read all the elements of the table and are not required to build this into the mapping file for some reason, you can easily use HQL for that... "from Login"

John


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