HIBERNATE Questions and Answers

State the role of SessionFactory interface plays in Hibernate.

• An application obtains Session instances from a SessionFactory which is typically single for the whole application created during its initialization.
• The SessionFactory caches generate SQL statements and other mapping metadata that Hibernate uses at runtime.
• It also holds cached data that has been read in one unit of work and may be reused in a future unit of work
SessionFactory sessionFactory = configuration.buildSessionFactory();