Jammy Lee
Jammy Lee

Reputation: 1516

Hibernate Session Connection Relationship

How many connection will hold for a single hibernate session where there is only one DB?

Upvotes: 3

Views: 2443

Answers (2)

Bozho
Bozho

Reputation: 597016

  • there is one connection per session.
  • the connection is opened only if the session needs to send JDBC queries
  • you should avoid using the underlying connection. The connection() method has been deprecated. If you need to perform raw jdbc operations, use the doWork(..) method (if your hibernate version is the latest)

Upvotes: 5

objects
objects

Reputation: 8677

At a given time given session will only hold one connection which you can access with the connect() method.

The connection used can be changed though using the reconnect() method.

Upvotes: 1

Related Questions