Which statement is correct ?
-
A Session will not obtain a JDBC Connection (or a Datasource) unless it is needed
-
A Session will obtain a JDBC Connection (or a Datasource) on object create
-
A Session has no relation with JDBC Connection (or a Datasource)
-
None of the above
A Hibernate Session obtains a JDBC connection lazily - only when it's actually needed for an operation. This improves efficiency by avoiding unnecessary database connections. The session doesn't grab a connection at creation time.
Hibernate Sessions are designed to lazily acquire a JDBC Connection (or Datasource) only when database access is actually required — for example, when a query executes or a flush happens — rather than immediately upon Session creation, which helps conserve connection pool resources.