what is the purpose and activity of SessionFactory in
hibernate?

Answer Posted / ankur

Configuration object is used to create a SessionFactory object which inturn configures Hibernate for the application using the supplied configuration file and allows for a Session object to be instantiated. The SessionFactory is a thread safe object and used by all the threads of an application.

The SessionFactory is is heavyweight object so usually it is created during application start up and kept for later use. You would need one SessionFactory object per database using a separate configuration file. So if you are using multiple databases then you would have to create multiple SessionFactory objects.

Is This Answer Correct ?    2 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is eclipse written in java?

710


What is java listener?

680


What do you mean by j2ee module?

723


Where can I find java developers?

695


What is container-managed sign-on?

727


What is a java applet?

706


What is java api for xml processing (jaxp)?

726


What is a j2ee module?

699


Why java is not 100% object oriented language?

693


How does j2ee application work?

680


Why is java called object oriented?

676


What is the difference between load() and get()?

738


What is entity reference?

697


What is isv?

665


What is included in j2ee?

669