Hibernate (Java) Question:

Download Job Interview Questions and Answers PDF

What is a SessionFactory? Is it a thread-safe object?

Hibernate Interview Question
Hibernate Interview Question

Answer:

SessionFactory is Hibernates concept of a single datastore and is threadsafe so that many threads can access it concurrently and request for sessions and immutable cache of compiled mappings for a single database. A SessionFactory is usually only built once at startup. SessionFactory should be wrapped in some kind of singleton so that it can be easily accessed in an application code.

Download Hibernate Interview Questions And Answers PDF

Previous QuestionNext Question
How will you configure Hibernate?What is a Session? Can you share a session object between different theads?