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
For Hibernate 4, you have to add
<mapping package="com.foo.bar.thepackage">
to your Hibernate config file.
I believe this is due to a bug in Spring, where it doesn't scan the annotations in package-info, but only those on classes annotated with @Entity, @Embeddable, or @MappedSuperclass. See https://jira.springsource.org/browse/SPR-8589.
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").
If using JPA, using
<class>com.foo.bar.thepackage</class>in the persistence.xml also should work.