what is the purpose and activity of SessionFactory in
hibernate?

Answer Posted / pranay bhawsar

The SessionFactory is created from a Configuration object, and as its name implies it is a factory for Session
objects.
 
The SessionFactory is an expensive object to create. It, like the Configuration object, is usually created during
application start up. However, unlike the Configuration object, It should be created once and kept for later
use.

The SessionFactory object is used by all the threads of an application. It is a thread safe object. One
SessionFactory object is created per database. Multiple SessionFactory objects (each requiring a separate
Configuration) are created when connecting to multiple databases. The SessionFactory can also provide
caching of persistent objects.

The main use of session factory object is to get the session object for the application.

Is This Answer Correct ?    71 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is jetty in java?

518


Enlist the technologies embraced in j2ee?

533


What is j2ee technology?

558


Is object a composite data type in java?

499


What is ejb jar file?

473






What is core java and j2ee?

512


Which is latest technology in java?

494


What are types of j2ee clients?

512


what is meant by proxy server

4179


What is java 2 platform, standard edition (j2se)?

529


What is a java ee container?

479


What is difference between j2ee and java?

505


What is main method in java?

512


How many types of constructors are there in java?

459


What do you mean by the component contract?

518