-->
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.  [ 8 posts ] 
Author Message
 Post subject: Middlegen-Hibernate-r3 compaoundKey error
PostPosted: Tue Nov 11, 2003 2:41 pm 
Beginner
Beginner

Joined: Sun Sep 07, 2003 9:04 am
Posts: 48
hello I am trying Middlegen-Hibernate-r3, I want to use hbm2java to generate the java file for Flight.hbm.xm,Person.hbm.xml,Reservation.hbm.xml, but I am getting the following errors.


panic-if-driver-not-present:

middlegen:
[echo] Class path = C:\Middlegen-Hibernate-r3\Middlegen-Hibernate-r3
[middlegen] Database URL:jdbc:hsqldb:C:\Middlegen-Hibernate-r3\Middlegen-Hibernate-r3/build/hsqldb/airline
[middlegen] No <table> elements specified. Reading all tables. This might take a while...
[middlegen] ********************************************************
[middlegen] * CTRL-Click relations to modify their cardinality *
[middlegen] * SHIFT-Click relations to modify their directionality *
[middlegen] ********************************************************
[middlegen] Updated preferences in C:\Middlegen-Hibernate-r3\Middlegen-Hibernate-r3\src\airline-prefs.properties

hbm2java:
[java] (hbm2java.CodeGenerator 43 ) Error parsing XML: file:/C:/Middlegen-Hibernate-r3/Middlegen-Hibernate-r3/build/gen-src/airline
/hibernate/Reservation.hbm.xml(47)
[java] org.xml.sax.SAXParseException: The content of element type "composite-id" must match "(key-property|key-many-to-one)+".
[java] at weblogic.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232)
[java] at weblogic.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:173)
[java] at weblogic.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:371)
[java] at weblogic.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:305)
[java] at weblogic.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:1918)
[java] at weblogic.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:851)
[java] at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1008)
[java] at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1
469)
[java] at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:329)
[java] at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:525)
[java] at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:581)
[java] at weblogic.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
[java] at weblogic.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1175)
[java] at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)
[java] at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:138)
[java] at org.jdom.input.SAXBuilder.build(SAXBuilder.java:354)
[java] at org.jdom.input.SAXBuilder.build(SAXBuilder.java:707)
[java] at org.jdom.input.SAXBuilder.build(SAXBuilder.java:689)
[java] at net.sf.hibernate.tool.hbm2java.CodeGenerator.main(CodeGenerator.java:93)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:208)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:150)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:443)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:163)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
[java] at org.apache.tools.ant.Task.perform(Task.java:341)
[java] at org.apache.tools.ant.Target.execute(Target.java:309)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
[java] at org.apache.tools.ant.Main.runBuild(Main.java:609)
[java] at org.apache.tools.ant.Main.start(Main.java:196)
[java] at org.apache.tools.ant.Main.main(Main.java:235)

compile-hibernate:
[javac] Compiling 3 source files to C:\Middlegen-Hibernate-r3\Middlegen-Hibernate-r3\build\classes

all:

BUILD SUCCESSFUL
Total time: 31 seconds
C:\Middlegen-Hibernate-r3\Middlegen-Hibernate-r3>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 11, 2003 6:18 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
This is likely to be similar to you other posting about weblogic although maybe you sorted it as you posted this one first. I need to see the mapping file(s) to provide futher information.


Top
 Profile  
 
 Post subject: Need updated DTD from v21 branch in CVS
PostPosted: Fri Nov 14, 2003 11:25 am 
Newbie

Joined: Fri Nov 14, 2003 11:15 am
Posts: 4
I had the same problem. Apparently, the hbm2java task is validating the hbm.xml file against the dtd shipped with hibernate, not against http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtdincluded in the DOCTYPE of each hbm.xml file. Running the validate task from ant has no errors, so I am thinking this task validates against the updated copy for web.

Anyway, thanks to an anonymous comment, I was able to fix it by downloading that file (actually the dtd from cvs at http://cvs.sourceforge.net/viewcvs.py/*checkout*/hibernate/Hibernate2/src/net/sf/hibernate/hibernate-mapping-2.0.dtd?rev=1.34.2.24
)
and replacing the old dtd in the hibernate2.jar. After rejarring, everything then worked. See my write up at http://www.mjwall.com/node/view/138

--Mike


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 14, 2003 11:27 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This is in the FAQ.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 14, 2003 11:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
oh ... perhaps I misunderstood you ...


Top
 Profile  
 
 Post subject: Sorry
PostPosted: Fri Nov 14, 2003 3:56 pm 
Newbie

Joined: Fri Nov 14, 2003 11:15 am
Posts: 4
Sorry, I am a little confused about you comment Mr King. Which FAQ's? Do mean the overall hibernate FAQ located at http://www.hibernate.org/14.html, or do you mean the page about Middlegen for Hibernate at http://www.hibernate.org/98.html. I mentioned in my comments on my weblog I went back and did see the "NOTE: Post hibernate 2.1beta5 DTD is required to validate correctly for all possible XDoclet meta tags." I should have mentioned that in the forum post.

What I was having trouble with was that the validate task in ant validated correctly, but the hbm2java task did not. Taking a look at the source for hibernate, I tried to figure out why this happens. The ant validate task calls the xmlvalidate task without a nested dtd entity, so I think it uses the internally defined dtd in the hbm.xml file, which is a current version at the given URL. The hbm2java task looks like it uses a custom DTDEntityResolver from the net.sf.hibernate.util package. I couldn't find any apidocs for it with the rest of the apidocs in the 2.0.3 distribution, but I did find the source. Since there is a hibernate-mapping-2.0.dtd in the hibernate2.jar which is on the classpath, it appears the DTDEntityResolver uses that one, which is an older version. I probably wouldn't have had this problem had I used the 2.1 beta version.

Thanks for you time. I am very new to hibernate, and only got on this forum today. I appreciate all of your and everyone else's great work

--Mike


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 14, 2003 6:39 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
There have been a few people trapped by this. Glad you found it documented on the Wiki. There are two areas that will cause the problem. The main one is if you are using optimistic locking and XDoclet generation. The next version will have more XDoclet markup for Compoundkeys but it will need the 2.1b6 DTD which is why I am not rushing to get this done.


Top
 Profile  
 
 Post subject: Re: Middlegen-Hibernate-r3 compaoundKey error
PostPosted: Sat Nov 15, 2003 4:33 am 
Beginner
Beginner

Joined: Sun Sep 07, 2003 9:04 am
Posts: 48
seybaa wrote:
hello I am trying Middlegen-Hibernate-r3, I want to use hbm2java to generate the java file for Flight.hbm.xm,Person.hbm.xml,Reservation.hbm.xml, but I am getting the following errors.


panic-if-driver-not-present:

middlegen:
[echo] Class path = C:\Middlegen-Hibernate-r3\Middlegen-Hibernate-r3
[middlegen] Database URL:jdbc:hsqldb:C:\Middlegen-Hibernate-r3\Middlegen-Hibernate-r3/build/hsqldb/airline
[middlegen] No <table> elements specified. Reading all tables. This might take a while...
[middlegen] ********************************************************
[middlegen] * CTRL-Click relations to modify their cardinality *
[middlegen] * SHIFT-Click relations to modify their directionality *
[middlegen] ********************************************************
[middlegen] Updated preferences in C:\Middlegen-Hibernate-r3\Middlegen-Hibernate-r3\src\airline-prefs.properties

hbm2java:
[java] (hbm2java.CodeGenerator 43 ) Error parsing XML: file:/C:/Middlegen-Hibernate-r3/Middlegen-Hibernate-r3/build/gen-src/airline
/hibernate/Reservation.hbm.xml(47)
[java] org.xml.sax.SAXParseException: The content of element type "composite-id" must match "(key-property|key-many-to-one)+".
[java] at weblogic.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232)
[java] at weblogic.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:173)
[java] at weblogic.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:371)
[java] at weblogic.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:305)
[java] at weblogic.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:1918)
[java] at weblogic.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:851)
[java] at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1008)
[java] at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1
469)
[java] at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:329)
[java] at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:525)
[java] at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:581)
[java] at weblogic.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
[java] at weblogic.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1175)
[java] at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)
[java] at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:138)
[java] at org.jdom.input.SAXBuilder.build(SAXBuilder.java:354)
[java] at org.jdom.input.SAXBuilder.build(SAXBuilder.java:707)
[java] at org.jdom.input.SAXBuilder.build(SAXBuilder.java:689)
[java] at net.sf.hibernate.tool.hbm2java.CodeGenerator.main(CodeGenerator.java:93)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:208)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:150)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:443)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:163)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
[java] at org.apache.tools.ant.Task.perform(Task.java:341)
[java] at org.apache.tools.ant.Target.execute(Target.java:309)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
[java] at org.apache.tools.ant.Main.runBuild(Main.java:609)
[java] at org.apache.tools.ant.Main.start(Main.java:196)
[java] at org.apache.tools.ant.Main.main(Main.java:235)

compile-hibernate:
[javac] Compiling 3 source files to C:\Middlegen-Hibernate-r3\Middlegen-Hibernate-r3\build\classes

all:

BUILD SUCCESSFUL
Total time: 31 seconds
C:\Middlegen-Hibernate-r3\Middlegen-Hibernate-r3>





My problem is solved i have download the new hinernate version,then build it then put it on my middlegen lib.
thanks a lot for your help great forum.


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