Blog Compass Lite 2.0 - personal blog About Me Album Bookmarks

Tuesday, February 07, 2006

Hibernate Forums - View topic - Xdoclet error, Attribute "unique" was already spec

Hibernate Forums - View topic - Xdoclet error, Attribute "unique" was already spec.

Problem scenario:

Using XDoclet 1.2.3 to generate mapping files for hibernate gives the following error messages for tag “many-to-one”:

BEGIN - EXCEPTION AND STACK TRACE:
hibernatedoclet:
[hibernatedoclet] (XDocletMain.start 47 ) Running

[hibernatedoclet] Generating mapping file for com.companyname.project.module.ClassName.
[hibernatedoclet] com.companyname.project.module.ClassName
[hibernatedoclet] (XDocletMain.start 53 ) Running
XDoclet failed.
[hibernatedoclet] (XDocletMain.start 54 ) < file
[file:C:/workspace/project/build/model/gen/
com/companyname/project/module/ClassName.hbm.xml:line 100] 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".

Solution:

Given in the above link, it is a reported bug of XDoclet 1.2.3 and was solved in version 1.3 (which is not yet a stable release). Instead of upgrading XDoclet as a whole I amended the hibernate-properties.xdt in xdoclet-hibernate-module-1.2.3.jar as stated in in this page.