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 containers in java?

458


Is j2ee a language or framework?

484


What is meant by applet in java?

480


Why awt is used in java?

506


How will you explain cdata?

563






What is component-managed sign-on ?

544


Define thin client?

518


What is j2ee architecture?

493


How many java languages are there?

510


What is the best java course?

515


What is the use of method save()?

540


when i m calling java for web browser . so browser it's not support. show error in browser: internal error occur. java.lang.NoClassDefFoundError. will you give me solution why it's not starting browser.? is there any consult with .net framework2.0?

1567


How many types of constructors are there in java?

463


What is the concept of connection pooling?

557


What is jetty in java?

520