Configuration cfg = new Configuration().configure(); cfg.buildSessionFactory()
cfg.buildSessionFactory() is deprecated starting hibernate 4 onwards.
Following code can be used to create session factory starting from hibernate 4
Configuration cfg = new Configuration().configure(); ServiceRegistry registry = new StandardServiceRegistryBuilder().applySettings(cfg.getProperties()).build(); factory = cfg.buildSessionFactory(registry);