Java Coder
Is buildSessionFactory() deprecated in hibernate 4?
2 Answer(s)      3 years and a month ago
Posted in : Hibernate


I am trying to develop an application in Hibernate 4. I am using the Hibernate build. Following code is given is the Hibernate documentation:

SessionFactory sessions = cfg.buildSessionFactory();

But when I am using it in Hibernate 4 its giving error.

can anyone help me in finding the correct solution?



View Answers

January 27, 2014 at 4:45 PM


There is change in the Hibernate 4 API So, you have to use a little different code.

Check the thread Create sessionfactory in Hibernate 4.


January 27, 2014 at 4:48 PM


Please check the tutorial:

Hibernate 4 create Session Factory: Example of creating Session Factory in Hibernate 4.

In the above tutorial you will find the code to correctly create the SessionFactory.

Above tutorial is using Hibernate build.

Following are the tutorials of Hibernate:


Related Tutorials/Questions & Answers: