Search code examples
javahibernateannotationsusertype

Why would Hibernate ignore package-info.java?


I'm trying to use Hibernate @TypeDef annotation on a package level, exactly as it is described in the Hibernate documentation. I'm using Hibernate 3.6 and Spring 3.0.7. The code compiles and the package-info.class is in the classpath, but still it is not seen by the Hibernate.

If I put @TypeDef on the class level, it's working, but not if I put in the package-info. I tried to google but couldn't find anything helpful.

Thank you!


Solution

  • You probably need to add a

    <resource package="com.foo.bar.thepackage"/>
    

    to your Hibernate config file, or to call configuration.addPackage("com.foo.bar.thepackage").