/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hibernate.util;

/**
 *
 * @author Ani
 */
import org.hibernate.*;
import org.hibernate.cfg.*;

public class HibernateUtil {

    private static final SessionFactory sessionFactory;

    static {
        try {
            System.out.println(hibernate.Userdata.class.getPackage().getName());
            sessionFactory = new AnnotationConfiguration().addPackage("hibernate").
                    addAnnotatedClass(hibernate.Userdata.class).
                    addAnnotatedClass(hibernate.Userstatistic.class).
                    addAnnotatedClass(hibernate.Passwordstore.class).
                    configure().buildSessionFactory();
        } catch (Throwable ex) {
            throw new ExceptionInInitializerError(ex);
        }
    }

    public static SessionFactory getSessionFactory() {
        return sessionFactory;
    }

}