Maven hbm2ddl: fixing java.lang.ArrayStoreException: sun.reflect.annotation.EnumConstantNotPresentExceptionProxy

Creating a DDL in the Maven build with the hibernate3-maven-plugin fails if you explicitly configure an array of javax.persistence.CascadeType values in your JPA annotations. The stacktrace is similar to

Once I realized what the actual cause is, the fix was simple. Turns out that the CascadeType is not in the classpath when Maven runs the hbm2ddl goal. Hence you need to add a dependency to JPA to the hibernate3-maven-plugin:

A solution to this exception in a different context was posted here: http://javahowto.blogspot.com/2008/10/solve-javalangarraystoreexception.html

2 thoughts on “Maven hbm2ddl: fixing java.lang.ArrayStoreException: sun.reflect.annotation.EnumConstantNotPresentExceptionProxy

Leave a Reply

Your email address will not be published. Required fields are marked *