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 should a junior java developer know?

554


What software is needed for java programming?

527


What is delegation?

619


What are the j2ee technologies?

564


What is container-managed persistence?

612






How do I become an expert in java?

541


What are the advantages of object-relational mapping (orm)?

555


What are the java backend technologies?

553


What is create method?

666


What is java ee architecture?

574


What is j2ee technology?

630


What does enterprise javabeans module contain?

598


What is awt package in java?

582


What is caller?

628


Is java an assembly language?

564