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 the latest technology used in java?

485


What are container services?

520


What is button in java?

463


What is authorization constraint?

523


What are struts?

494






Is object a composite data type in java?

477


What is a web container in j2ee?

486


Why is j2ee needed?

474


how to run servlet program between two computer through internet ?

2525


What is java developer?

453


What is the mvc on struts?

490


What is attribute what is asant?

492


What is deployment descriptor?

554


What do you understand by j2ee?

462


What is application component provider?

534