package app;

import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;

/**
 * Created by Petr Flégl on 11.10.2016.
 */
    public class HibernateUtil {
        private static SessionFactory sessionFactory ;
        static {
            Configuration configuration = new Configuration().configure();
            StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
            sessionFactory = configuration.buildSessionFactory(builder.build());
        }
        public static SessionFactory getSessionFactory() {
            return sessionFactory;
        }
    }

