firends im 使用 netbeans ide 并将其放置在默认 src/java 文件夹中的 hibernate.cfg.xml 但是每当我运行应用程序时,它都会显示以下错误:
Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not found
班级 :
public class myutil {
private static final SessionFactory sessionFactory = buildsf();
public static SessionFactory buildsf() {
try {
// Create the SessionFactory from standard (hibernate.cfg.xml)
return new Configuration().configure("config/hibernate.cfg.xml").buildSessionFactory();
} catch (Throwable ex) { // Log the exception.
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
}