Jboss AS 7.1.1에 배포 된 EAR 파일이 있습니다.jboss 7에서 Hibernate.cfg.xml을 찾을 수 없습니다.
EJB 프로젝트 중 하나에서 META-INF 폴더 아래에 persistence.xml 파일이 있습니다.
private SessionFactory buildSessionFactory() throws Exception {
SessionFactory factory = null;
try{
Configuration configuration = new Configuration();
configuration.addResource("/META-INF/persistence.xml");
configuration.configure().setProperty("hibernate.show_sql", "false"); ---> **throws error**
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
factory = configuration.buildSessionFactory(serviceRegistry);
}
catch (Throwable t){
throw new Exception(t);
}
return factory;
}
문제는 내가 갖는 것입니다 : org.hibernate.HibernateException: /hibernate.cfg.xml not found
그래서 내가 세션 공장을 얻기 위해이 코드를 쓴 DB에서 일괄 업데이트를 할 필요가 있었다.
hibernate.cfg.xml
대신 persistence.xml
파일을 사용하도록 최대 절전 모드를 설정하려면 어떻게해야합니까?
업데이트 : 난 내가 잘못된 방법을 사용하는 것을 알아 냈다
:
configuration.configure("/META-INF/persistence.xml");
하지만 지금은 제이 보스 지속성 때문에, 다른 문제가 :
configuration.addResource("/META-INF/persistence.xml");
될해야 .xml은 hibernate.cfg.xml과 같은 구조를 가지지 않으므로 유효하지 않은 구성 예외가 발생합니다.
여기에서 취할 수있는 올바른 코스는 무엇입니까?
업데이트하는 대신 질문에 대답하고 수락 할 수도 있습니다. 그래서 앞으로 다른 사람들에게 도움이 될 것입니다. –