I use Xdoclet (1.2.3) to generate my mapping files.
Here is the basic code I use :
Code:
package events;
/**
* @hibernate.class
*/
public class Basic {
/**
* @hibernate.id generator-class="native"
*/
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
my xdoclet configuration (.xdoclet file):
Code:
<?xml version="1.0" encoding="UTF-8"?>
<configurations>
<configuration name="Hibernate" used="true">
<task className="xdoclet.modules.hibernate.HibernateDocletTask" name="hibernatedoclet" used="true">
<attribute name="excludedTags" used="false" value=""/>
<attribute name="destDir" used="true" value="src"/>
<attribute name="mergeDir" used="false" value=""/>
<attribute name="force" used="false" value=""/>
<attribute name="verbose" used="false" value=""/>
<attribute name="addedTags" used="false" value=""/>
<element name="hibernate" used="true">
<attribute name="Version" used="false" value="3.0"/>
<attribute name="useIds" used="false" value=""/>
<attribute name="xmlencoding" used="false" value=""/>
<attribute name="schema" used="false" value=""/>
<attribute name="validateXML" used="false" value=""/>
<attribute name="acceptInterfaces" used="false" value=""/>
<attribute name="acceptAbstractClasses" used="false" value=""/>
<attribute name="packageSubstitutions" used="false" value=""/>
<attribute name="packageSubstitutionInheritanceSupported" used="false" value=""/>
<attribute name="subTaskClassName" used="false" value=""/>
<attribute name="prefixWithPackageStructure" used="false" value=""/>
<attribute name="destinationFile" used="false" value=""/>
<attribute name="templateURL" used="false" value=""/>
<attribute name="templateFile" used="false" value=""/>
<attribute name="Extent" used="false" value=""/>
<attribute name="havingClassTag" used="false" value=""/>
<attribute name="ofType" used="false" value=""/>
<attribute name="subTaskName" used="false" value=""/>
<attribute name="destDir" used="false" value=""/>
<attribute name="mergeDir" used="false" value=""/>
<attribute name="currentMethodTag" used="false" value=""/>
<attribute name="currentClassTag" used="false" value=""/>
<attribute name="currentFieldTag" used="false" value=""/>
<attribute name="currentPackage" used="false" value=""/>
<attribute name="currentMethod" used="false" value=""/>
<attribute name="currentConstructor" used="false" value=""/>
<attribute name="currentField" used="false" value=""/>
<attribute name="currentClass" used="false" value=""/>
</element>
<element name="fileset" used="true">
<attribute name="dir" used="true" value="src"/>
<attribute name="includes" used="true" value="**/events/*.java"/>
<attribute name="excludes" used="false" value=""/>
</element>
</task>
</configuration>
</configurations>
and finally, the problem, when I run XDoclet :
Code:
[hibernatedoclet] xdoclet.XDocletException: Class events.Basic misses ID property
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateTagsHandler.hasCompositeId_Impl(HibernateTagsHandler.java:668)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateTagsHandler.ifHasPrimitiveId(HibernateTagsHandler.java:211)
[hibernatedoclet] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[hibernatedoclet] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[hibernatedoclet] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[hibernatedoclet] at java.lang.reflect.Method.invoke(Method.java:585)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invoke(TemplateEngine.java:641)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeMethod(TemplateEngine.java:567)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeBlockMethod(TemplateEngine.java:965)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleBlockTag(TemplateEngine.java:932)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleTag(TemplateEngine.java:472)
[hibernatedoclet] at xdoclet.template.TemplateEngine.generate(TemplateEngine.java:348)
[hibernatedoclet] at xdoclet.template.TemplateEngine.start(TemplateEngine.java:415)
[hibernatedoclet] at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:562)
[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.executeSortedTargets(Project.java:1216)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[hibernatedoclet] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
Any idea ?