(如果您正在使用hibernate注释)
在通知Hibernate捆绑包有关注释类的信息后,保存所有Entities类加载器。
然后在构建SessionFactory之前执行类似的操作。
ClassLoad cl = Thread.currentThread().getContextClassLoader();try { Thread.currentThread().setContextClassLoader(yourClassLoader); factory = cfg.buildSessionFactory(); }finally { Thread.currentThread().setContextClassLoader(cl); // restore the original class loader}


