Hibernate (Java) Question:

Download Job Interview Questions and Answers PDF

What role does the Session interface play in Hibernate?

Hibernate Interview Question
Hibernate Interview Question

Answer:

The Session interface is the primary interface used by Hibernate applications. It is a single-threaded, short-lived object representing a conversation between the application and the persistent store. It allows you to create query objects to retrieve persistent objects.

Session session = sessionFactory.openSession();
Session interface role:

* Wraps a JDBC connection
* Factory for Transaction
* Holds a mandatory (first-level) cache of persistent objects, used when navigating the object graph or looking up objects by identifier

Download Hibernate Interview Questions And Answers PDF

Previous QuestionNext Question
What are the Core interfaces are of Hibernate framework?What role does the SessionFactory interface play in Hibernate?