views:

64

answers:

2

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

A: 

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.

objects
thanks for your fast reply, and can a single session hold more than one connection for more than one DB?
Jammy Lee
No, a session can only hold a single connection.
objects
+1  A: 
  • 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)
Bozho