-->
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: orderby required for a set?
PostPosted: Tue Oct 12, 2004 11:14 am 
Newbie

Joined: Mon Sep 13, 2004 4:00 pm
Posts: 15
Location: WI
As you can see from the stack trace below, it says that I have a problem with my mapping file. It is saying that orderby is required for a set? According the the documentation, order-by is optional, and only supported with JDK1.4 (currently using 1.3).

Is the mapping for a set element, different than a map element?

Hibernate version: 2.1

Mapping documents: Only showing relevent part:

Code:
...
<set cascade="all" lazy="true" name="clientGroups">
            <key column="clientId"/>
            <one-to-many class="com.lmig.pm.affinity.model.client.ClientGroup"/>
</set>
...


Code between sessionFactory.openSession() and session.close():

I haven't opened the session yet, it is an error in the mapping file when I load the configuration.

Full stack trace of any exception that occurs:

Code:
net.sf.hibernate.MappingException: Error reading resource: HibernateConn/mapping.hbm.xml
   at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:339)
   at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1013)
   at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:969)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:883)
   at HibernateConn.HibernatePull.<init>(HibernatePull.java:25)
   at HibernateConn.HibernatePull.main(HibernatePull.java:33)
Caused by: net.sf.hibernate.MappingException: invalid mapping
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:287)
   at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:336)
   ... 6 more
Caused by: org.xml.sax.SAXParseException: Attribute "orderby" must be declared for element type "set".
   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)(Inlined Compiled Code)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(Unknown Source)(Compiled Code)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(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:339)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:286)
   ... 7 more


Name and version of the database you are using:

DB2

The generated SQL (show_sql=true):

...

Debug level Hibernate log excerpt:
...

[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 12, 2004 11:50 am 
Newbie

Joined: Mon Sep 13, 2004 4:00 pm
Posts: 15
Location: WI
I added an orderby column to each of my set elements, and still go the same error. Is there a way to find out what line the error occured on in the mapping file? Our mapping file is over 1000 lines long.


Top
 Profile  
 
 Post subject: It's "order-by", not "orderby"
PostPosted: Tue Oct 12, 2004 12:48 pm 
Newbie

Joined: Fri Oct 08, 2004 11:59 am
Posts: 16
Location: Helsinki, Finland
It's the other way around: you cannot have an attribute named "orderby".
In the DTD the allowed attribute is "order-by" (note the hyphen), and your validating parser complains
about the unknown attribute "orderby", which you have somewhere in the mapping file.

So just grep for that and delete it, and it should work.

- Ville Peurala


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 12, 2004 1:26 pm 
Newbie

Joined: Mon Sep 13, 2004 4:00 pm
Posts: 15
Location: WI
Thanks. That was the problem.


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.