I am using Hibernate latest version 4.3.5.Final
.
My hibernate.cfg.xml
file content:
// Create Configuration File and configure it.
Configuration configuration=new Configuration();
configuration.configure("com/sathya/config/emp.cfg.xml");
// Create Service Registry
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
// Create Session Object using SessionFactory Interface
SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry);
Session session=sessionFactory.openSession();
// new StandardServiceRegistryBuilder().applySettings(new Configuration().getProperties());
// Session session=new Configuration().buildSessionFactory(new StandardServiceRegistryBuilder().build()).openSession();