Monday, 31 March 2014

buildSessionFactory() after Hibernate 4


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);

No comments:

Post a Comment