-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate XDoclet
PostPosted: Mon Sep 20, 2004 7:56 am 
Beginner
Beginner

Joined: Wed Sep 15, 2004 3:14 am
Posts: 35
Hibernate version: 2.1.6

Mapping documents:

Code:
<hibernate-mapping>
    <class
        name="CategorizedItem"
        table="CATEGORIZED_ITEM"
        dynamic-update="false"
        dynamic-insert="false"
    >
        <composite-id
            name="id"
            class="org.hibernate.auction.model.CategorizedItem.Id"
            unsaved-value="any"
        >
        </composite-id>
        <property
            name="username"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="USERNAME"
            not-null="true"
        />
        <property
            name="dateAdded"
            type="java.util.Date"
            update="true"
            insert="true"
            access="property"
            column="DATE_ADDED"
            not-null="true"
        />
    </class>
</hibernate-mapping>


Full stack trace of any exception that occurs:
Quote:
[hibernatedoclet] (XDocletMain.start 47 ) Running <hibernate/>
[hibernatedoclet] Generating mapping file for org.hibernate.auction.model.CategorizedItem.
[hibernatedoclet] org.hibernate.auction.model.CategorizedItem
[hibernatedoclet] org.xml.sax.SAXParseException: The content of element type "composite-id" is incomplete, it must match "(meta*,(key-property|key-many-to-one)+)".
[hibernatedoclet] at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
[hibernatedoclet] at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
[hibernatedoclet] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
[hibernatedoclet] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
[hibernatedoclet] at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
[hibernatedoclet] at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
[hibernatedoclet] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
[hibernatedoclet] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
[hibernatedoclet] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
[hibernatedoclet] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
[hibernatedoclet] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
[hibernatedoclet] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
[hibernatedoclet] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
[hibernatedoclet] at xdoclet.util.XmlValidator.doValidate(XmlValidator.java:220)
[hibernatedoclet] at xdoclet.util.XmlValidator.validate(XmlValidator.java:189)
[hibernatedoclet] at xdoclet.XmlSubTask.engineFinished(XmlSubTask.java:242)
[hibernatedoclet] at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:562)
[hibernatedoclet] at xdoclet.TemplateSubTask.generateForClass(TemplateSubTask.java:767)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:667)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:594)
[hibernatedoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:198)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateSubTask.execute(HibernateSubTask.java:123)
[hibernatedoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:462)
[hibernatedoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:110)
[hibernatedoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[hibernatedoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatedoclet] at org.apache.tools.ant.Target.execute(Target.java:341)
[hibernatedoclet] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[hibernatedoclet] (XDocletMain.start 53 ) Running XDoclet failed.
[hibernatedoclet] (XDocletMain.start 54 ) <<Couldn't validate document C:\Program Files\Eclipse SDK\model\CategorizedItem.hbm.xml>>
[hibernatedoclet] C:\Program Files\Eclipse SDK\workspace\build.xml:190: XDoclet failed.
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:465)
[hibernatedoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:110)
[hibernatedoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[hibernatedoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatedoclet] at org.apache.tools.ant.Target.execute(Target.java:341)
[hibernatedoclet] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[hibernatedoclet] Caused by: xdoclet.XDocletException: Couldn't validate document C:\Program Files\Eclipse SDK\model\CategorizedItem.hbm.xml
[hibernatedoclet] at xdoclet.util.XmlValidator.doValidate(XmlValidator.java:224)
[hibernatedoclet] at xdoclet.util.XmlValidator.validate(XmlValidator.java:189)
[hibernatedoclet] at xdoclet.XmlSubTask.engineFinished(XmlSubTask.java:242)
[hibernatedoclet] at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:562)
[hibernatedoclet] at xdoclet.TemplateSubTask.generateForClass(TemplateSubTask.java:767)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:667)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:594)
[hibernatedoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:198)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateSubTask.execute(HibernateSubTask.java:123)
[hibernatedoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:462)
[hibernatedoclet] ... 9 more
[hibernatedoclet] --- Nested Exception ---
[hibernatedoclet] xdoclet.XDocletException: Couldn't validate document C:\Program Files\Eclipse SDK\model\CategorizedItem.hbm.xml
[hibernatedoclet] at xdoclet.util.XmlValidator.doValidate(XmlValidator.java:224)
[hibernatedoclet] at xdoclet.util.XmlValidator.validate(XmlValidator.java:189)
[hibernatedoclet] at xdoclet.XmlSubTask.engineFinished(XmlSubTask.java:242)
[hibernatedoclet] at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:562)
[hibernatedoclet] at xdoclet.TemplateSubTask.generateForClass(TemplateSubTask.java:767)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:667)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:594)
[hibernatedoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:198)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateSubTask.execute(HibernateSubTask.java:123)
[hibernatedoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:462)
[hibernatedoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:110)
[hibernatedoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[hibernatedoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatedoclet] at org.apache.tools.ant.Target.execute(Target.java:341)
[hibernatedoclet] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)


The Problem:

Trying to use XDoclet to generate the Hibernate mapping for the CategorizedItem class and other classes, the problem I have here is just this class and its subclass Id.

In the CategoriezedItem, I have this code:

Code:
@hibernate.class table="CategorizedItem"
@hibernate.id generator-class="Id" unsaved-value="any"


In the subclass Id, I have this code:

Code:
@hibernate.many-to-one column="categoryId"
@hibernate.many-to-one column="citemId"


When I run ant to generate the mapping files, it generates CategorizedItem.hbm.xml mapping file and displays the error (exception above).

Base on the CategorizedItem.hbm.xml file, the tags in the Id class didn't get parse. If I put in the Getters and Setters, the tags do get parsed. Here comes the second problem.

In your CategorizedItem.hbm.xml mapping file, you have:

Code:
<composite-id name="id" class="CategorizedItem$Id"
                 access="org.hibernate.auction.persistence.DirectSetAccessor"
                 unsaved-value="any">


But my file has this code:

Code:
        <composite-id
            name="id"
            class="org.hibernate.auction.model.CategorizedItem.Id"
            unsaved-value="any"
        >


Notice the CategorizedItem$Id vs CategorizedItem.Id

What can I do about this? I would like to use XDoclet to generate the mapping files. Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.