我有单独的jar 文件已经包含了hibernate 实体映射和直接映射。我的 Hibernate confg (cgf.xml) 放在另一个 jar 文件中。结果我发现异常“资源:com/iceleads/data/Test.hbm.xml not found”。
例子:
entities.jar
com.package.entity.TestEntity.java
com.package.entity.TestEnity.hbm.xml
mainUsage.jar
com.package.main.MainClass.java - there are I get session factory
SessionFactory factory = HibernateUtil.getSessionFactory();
com.package.main.hibernate.cfg.xml
in HibernateUtil
sessionFactory = new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();
in hibernate.cfg.xml
<mapping resource="com/package/entity/TestEntity/Test.hbm.xml"/>
在 mainUsage.jar 类路径中的 entity.jar
请建议我如何配置 hibernate.cfg.xml 以将单独的 jar 与实体一起使用。
非常感谢!
阿尔乔姆