If you're using Maven's hibernate3-maven-plugin
for creating a DDL file from your entities, you might encounter the following error when using Java 1.7:
Execution default of goal org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2ddl failed: An AnnotationConfiguration instance is required
The reason seems to be a broken JRE detection in the Mojo code, which mistakenly assumes that Java 1.7 does not support annotations. However, I haven't checked that in depth.
The fix is pretty easy. In the plugin configuration of the hibernate3-maven-plugin
, add an implementation
property to the componentProperties
like this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<componentProperties>
<implementation>annotationconfiguration</implementation>
</componentProperties>
</configuration>
</plugin>
This enforces the use of an AnnotationConfiguration
instance.