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

What are the modules of j2ee?

591


What is context attribute?

638


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

619


What is j2ee product provider?

630


Since we can create managed bean by two ways as, we can define the bean name in faces-config.xml file so that page can use that OR we can write annotation on bean class so that it is automatically assign to page but I want to know which one is good programming practice ? And also mention disadvantage of other which should not prefer ... Thanking you...

1967






What is ebxml?

586


What is cmp in j2ee?

567


What is jaap?

634


What is j2ee module?

665


What is interpreter in java?

526


What is java api for xml registries (jaxr)?

626


Which package is imported by default in java?

625


What is create method?

666


What are the advanced technologies in java?

566


Explain the four types of container that the j2ee specification defines

567