为什么 Hibernate 会忽略 package-info.java? [英] Why would Hibernate ignore package-info.java?
问题描述
我正在尝试在包级别使用 Hibernate @TypeDef 注释,正如 休眠文档.我正在使用 Hibernate 3.6
和 Spring 3.0.7
.代码编译并且 package-info.class
在类路径中,但 Hibernate 仍然看不到它.
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.
如果我将 @TypeDef
放在类级别,它会起作用,但如果我放入 package-info
,则不会.我试着用谷歌搜索但找不到任何有用的东西.
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.
谢谢!
推荐答案
您可能需要添加一个
<resource package="com.foo.bar.thepackage"/>
到你的 Hibernate 配置文件,或者调用 configuration.addPackage("com.foo.bar.thepackage").
to your Hibernate config file, or to call configuration.addPackage("com.foo.bar.thepackage").
这篇关于为什么 Hibernate 会忽略 package-info.java?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!