我正在使用休眠注释。
在我所有的模型类中,我都这样注释:
@Entity
@Table
public class SomeModelClass {
//
}
我的 hibernate.cfg.xml 是
<hibernate-configuration>
<session-factory>
<!-- some properties -->
<mapping package="com.fooPackage" />
<mapping class="com.fooPackage.SomeModelClass" />
</session-factory>
</hibernate-configuration>
对于我添加到 com.fooPackage 的每个类,我必须在 hibernate.cfg.xml 中添加一行,如下所示:
<mapping class="com.fooPackage.AnotherModelClass" />
有没有办法可以添加新的模型类但不需要将此行添加到 hibernate.cfg.xml?