What is the role of SessionFactory?

Answer

The application obtains session object from SessionFactory interface. Typically there should be only one sessionFacory for whole application and is loaded during application initialization. The SessionFactory caches generate SQL Statement and other mapping metadata that Hibernate use at runtime. It also hold cached data that has been read in one unit of work and can be reused in a future unit of work.

You can get the instance of SessionFactory by the configuration object as below

SessionFactory sessionFactory = configuration.buildSessionFactory();

All hibernate Questions

Ask your interview questions on hibernate

Write Your comment or Questions if you want the answers on hibernate from hibernate Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---