-->
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.  [ 4 posts ] 
Author Message
 Post subject: "Error parsing XML" for list mapping
PostPosted: Wed Sep 14, 2005 5:22 pm 
Newbie

Joined: Wed Sep 14, 2005 5:13 pm
Posts: 13
Hey guys!
I have a problem with my hibernate config for a list:
it says I don't use the right child elements for the <list> xml
element.
...but i can't see anything wrong.
It's surely my fault, but could someone still point
me in the right direction?

Thanks a lot!

----

Hibernate version:
3.0.5

Mapping documents:
<?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 package="net.bitalchemy.omnitheca.model.catalog">

<class name="CatalogModel" table="catalogmodels">
<id name="id" column="CATALOGMODEL_ID">
<generator class="increment"/>
</id>

<property name="name"/>
<property name="comment"/>

<list name="fields">
<list-index column="field_index"/>
<key column="CATALOGMODEL_ID"/>
<one-to-many class="Field"/>
</list>

</class>

</hibernate-mapping>

Full stack trace of any exception that occurs:
INFO - Hibernate 3.0.5
INFO - hibernate.properties not found
INFO - using CGLIB reflection optimizer
INFO - using JDK 1.4 java.sql.Timestamp handling
INFO - Mapping resource: net/bitalchemy/omnitheca/model/catalog/CatalogModel.hbm.xml
ERROR - Error parsing XML: XML InputStream(20) The content of element type "list" must match "(meta*,subselect?,cache?,synchronize*,comment?,key,(index|list-index),(element|one-to-many|many-to-many|composite-element|many-to-any),loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?,filter*)".
Exception occurred during event dispatching:
org.hibernate.MappingException: Error reading resource: net/bitalchemy/omnitheca/model/catalog/CatalogModel.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:452)
......


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 5:32 pm 
Beginner
Beginner

Joined: Tue Apr 05, 2005 4:27 pm
Posts: 40
Location: canada
try this...

<list name="fields">
<key column="CATALOGMODEL_ID"/>
<list-index column="field_index"/>
<one-to-many class="Field"/>
</list>

(define key before index...)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 5:44 pm 
Newbie

Joined: Wed Sep 14, 2005 5:13 pm
Posts: 13
incredible, that did the trick ;)
thanks a lot for the quick answer!

why do they check the order of the XML elements?
doesn't make much sense to me...

anyway, the non-working example
(with <list-index> before <key>)
was copied straight
out of the book "hibernate quickly" from manning books.
it's strange that would not run...

thanks again


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 15, 2005 12:04 pm 
Beginner
Beginner

Joined: Tue Apr 05, 2005 4:27 pm
Posts: 40
Location: canada
no problem. the order of elements in the mapping is defined by the dtd so i guess the example you were following was mistaken.


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