Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 526
Alex Vayda Avatar asked Oct 12 '25 15:10

Alex Vayda


2 Answers

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").

like image 132
JB Nizet Avatar answered Oct 14 '25 06:10

JB Nizet


If using JPA, using

<class>com.foo.bar.thepackage</class>
in the persistence.xml also should work.
like image 36
Chris Avatar answered Oct 14 '25 05:10

Chris