-->
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.  [ 2 posts ] 
Author Message
 Post subject: Xdoclet error, Attribute "unique" was already spec
PostPosted: Mon May 30, 2005 2:11 am 
Beginner
Beginner

Joined: Tue Sep 09, 2003 5:20 pm
Posts: 43
I'm just moved from xdoclet 1.2.2 to 1.2.3 and am now getting an error generating my hibernate hbm.xml files. Did not find this covered elsewhere.

Thank you for any suggestions - Richard

Hibernate version: 2.1.8 or 3.0.5

Mapping documents:

Below is the markup in my classes followed by the the exception and stack trace from my ant build. Note that the many-to-one tag that is generated for my "status" property ends up with two instances of the attribute/keyword 'unique="false"'.

Is this a bug or do I just need to change my configuration somehow?

Thank you - Richard

BEGIN CLASSES WITH MARKUP:
...
/**
* @hibernate.class table="PoResult"
proxy="com.ltoj.persistence.base.PoResult"
*/
public class PoResult extends PoBaseObjectWithId {
...
}


/**
* No hibernate class/subclass declaration should be here */ public abstract class PoBaseObjectWithId
extends LoggableObject
implements Serializable, PoAuditable {

private Long id;
private int version;
private String discriminator;
private PoStatus status;
...

/**
* @hibernate.id type="long" generator-class="native"
unsaved-value="null"
* @hibernate.column name="id" unique-key="id"
*/
public Long getId() {
return id;
}
...

/**
* @hibernate.many-to-one not-null="false" unique="false"
outer-join="false"
*/
public PoStatus getStatus() {
return status;
}
...
}

END - CLASSES WITH MARKUP

BEGIN - GENERATED HBM.XML FILE
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="com.ltoj.persistence.base.PoResult"
table="PoResult"
proxy="com.ltoj.persistence.base.PoResult"
>
<id
name="id"
type="long"
unsaved-value="null"
>
<column
name="id"
unique-key="id"
/>
<generator class="native">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-PoResult.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<SNIP>
<many-to-one
name="status"
class="com.ltoj.persistence.base.PoStatus"
cascade="none"
outer-join="false"
update="true"
insert="true"
<!-- --> unique="false"
column="status"
not-null="false"
<!-- --> unique="false" <NOTE>THIS IS LINE 108 IN THE COMPLETE
GENERATED HBM.XML FILE</NOTE>
/>
</class>

</hibernate-mapping>
<NOTE
END - GENERATED HBM.XML FILE

Code between sessionFactory.openSession() and session.close():N/A

Full stack trace of any exception that occurs:

BEGIN - EXCEPTION AND STACK TRACE:
hibernatedoclet:
[hibernatedoclet] (XDocletMain.start 47 ) Running
<hibernate/>
[hibernatedoclet] Generating mapping file for com.ltoj.persistence.base.PoResult.
[hibernatedoclet] com.ltoj.persistence.base.PoResult
[hibernatedoclet] (XDocletMain.start 53 ) Running
XDoclet failed.
[hibernatedoclet] (XDocletMain.start 54 ) <<Generated
file
[file:C:/EclipseProjects/workspace/starsModel/build/persistence/src-gen/
com/ltoj/persistence/base/PoResult.hbm.xml:line 108] Message=[Attribute "unique" was already specified for element "many-to-one".] is not valid according to its DTD or XML Schema. This might be due to some missing tags in your source.>> [hibernatedoclet] org.xml.sax.SAXParseException: Attribute "unique" was alreadyspecified for element "many-to-one".
[hibernatedoclet] at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unkno
wn Source)
[hibernatedoclet] at
org.apache.xerces.util.ErrorHandlerWrapper.fatalError(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.XMLScanner.reportFatalError(Unknown Source)
[hibernatedoclet] at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanAttribute(Unkn
own Source)
[hibernatedoclet] at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(U
nknownSource)
[hibernatedoclet] at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis
patcher.dispatch(Unknown Source)
[hibernatedoclet] at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unkno
wn 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:271)
[hibernatedoclet] at
xdoclet.util.XmlValidator.validate(XmlValidator.java:221)
[hibernatedoclet] at
xdoclet.XmlSubTask.engineFinished(XmlSubTask.java:281)
[hibernatedoclet] at
xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:564)
[hibernatedoclet] at
xdoclet.TemplateSubTask.generateForClass(TemplateSubTask.java:779)
[hibernatedoclet] at
xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:679)
[hibernatedoclet] at
xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:596)
[hibernatedoclet] at
xdoclet.XmlSubTask.startProcess(XmlSubTask.java:227)
[hibernatedoclet] at
xdoclet.modules.hibernate.HibernateSubTask.execute(HibernateSubTask.java
:136)
[hibernatedoclet] at
xdoclet.XDocletMain.start(XDocletMain.java:48)
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:468)
[hibernatedoclet] at
xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:105)
[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.apache.tools.ant.Main.runBuild(Main.java:673)
[hibernatedoclet] at
org.apache.tools.ant.Main.startAnt(Main.java:188)
[hibernatedoclet] at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
[hibernatedoclet] at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
[hibernatedoclet] C:\EclipseProjects\workspace\starsModel\build.xml:109:
XDoclet failed.
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:471)
[hibernatedoclet] at
xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:105)
[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.apache.tools.ant.Main.runBuild(Main.java:673)
[hibernatedoclet] at
org.apache.tools.ant.Main.startAnt(Main.java:188)
[hibernatedoclet] at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
[hibernatedoclet] at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
...
END - EXCEPTION AND STACK TRACE:

Name and version of the database you are using:MySQL 4.1.7

The generated SQL (show_sql=true):N/A

Debug level Hibernate log excerpt:N/A


Top
 Profile  
 
 Post subject: Xdoclet error, Attribute "unique" was already spec
PostPosted: Tue May 31, 2005 9:50 am 
Beginner
Beginner

Joined: Tue Sep 09, 2003 5:20 pm
Posts: 43
Turns out this is a bug. I loosened up my search criteria and found that this is already a reported bug:

http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1349

However the fix is applied to version 1.3 which is not yet stable, at least for my purposes (from my quick experience documented below).

The good news is that the fix only involved commenting out 3 lines in hibernate-properties.XDt (see the problem report above for details).

All is well, isn't open source a great thing :)

- Richard


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