I am using XDoclet 1.2.3 and Hibernate 3.2. I am currently migrating code from Hibernate 2 to Hibernate 3.2.
Using Ant I generate the .hbm.xml files from my entity classes, using the following:
Code:
<hibernatedoclet
destdir="${generated.home}"
excludedtags="@version,@author,@todo"
force="${generated.forced}"
mergedir="${generated.home}"
verbose="false">
<fileset dir="${src.home}">
<include name="**/entity/**/*.java"/>
</fileset>
<hibernate version="3.0"/>
</hibernatedoclet>
Running this the mapping files are generated without apparent error. The issues arises when I try running my application. What happens is that I get the following error:
Code:
23 juil. 2008 11:41:06,653 DEBUG DTDEntityResolver:38 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
23 juil. 2008 11:41:06,653 DEBUG DTDEntityResolver:40 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
23 juil. 2008 11:41:06,653 DEBUG DTDEntityResolver:50 - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
23 juil. 2008 11:41:06,699 ERROR XMLHelper:61 - Error parsing XML: XML InputStream(61) Attribute "unique" was already specified for element "many-to-one".
Looking through the generated hbm.xml files I do indeed see a "many-to-one" with two "unique" attributes:
Code:
<many-to-one
name="company"
class="com.myco.entity.general.Compagnie"
cascade="none"
outer-join="auto"
update="true"
insert="true"
unique="true"
column="idCompany"
unique="true"
/>
The declaration in my class file , named 'Order.java', is the corresponding method:
Code:
/**
* @return Returns the company.
* @hibernate.many-to-one column="idCompany" unique="true"
*/
public Company getCompany () {
return this.company;
}
Can anyone suggest what is going on? I can't see any unique keyword specified in the Company class?