Reputation: 315
I am confused about the hibernate session and connection pool, are they the same thing?
Upvotes: 16
Views: 6116
Reputation: 61178
Hibernate is an ORM, it is a layer between a SQL database and your POJOs.
A connection pool provides a way to store and reuse java.sql.Connection
instances for speed and robustness.
A hibernate Session
is a wrapper around a Connection
in order to allow you to save your POJOs without directly writing the SQL.
So a hibernate Session
is a wrapper around a Connection
. Connection
s are held in a connection pool.
When you call SessionFactory.openSession
hibernate first takes a Connection
from the supplied connection pool. It then creates a Session
around that Connection
and returns it.
Upvotes: 22