与SLF4J

时间:2016-05-16 09:28:17

标签: java hibernate

我无法创建sessionFactory。它引发了一个例外。请帮我解决一下:

public class HibernateUtil<ServiceRegistryBuilder> {

 private static final SessionFactory sessionFactory;

    static{
        try{
            sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();

        }catch (Throwable ex) {
            System.err.println("Session Factory could not be created." + ex);
            throw new ExceptionInInitializerError(ex);
        }   
    }

    public static SessionFactory getSessionFactory() {
        return sessionFactory;
    }

}

0 个答案:

没有答案