Tuesday, July 23, 2013

Hibernate SessionFactory buildSessionFactory deprecated fix


Fix for Hibernate SessionFactory buildSessionFactory deprecation as of Hibernate 4.0 

private static SessionFactory sessionFactory;
private static ServiceRegistry serviceRegistry;

private static SessionFactory configureSessionFactory() throws HibernateException {
   Configuration configuration = new Configuration();
   configuration.configure();
   serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();        
   sessionFactory = configuration.buildSessionFactory(serviceRegistry);
   return sessionFactory;
}



1 comment:

  1. Such a nice Blog, thanks for sharing such important info about Industrial gases supplier .Keep learning Keep loving.

    ReplyDelete