Fix connection leak problem in hibernate-core tests

Description

When running tests on PostgreSQL with a max_connections value of 10, the tests are failing because connections are still in use. We need to add proper resource handling so that even if we get an exception, the transaction is rolled back and the connections are released.

Environment

None

Status

Assignee

Vlad Mihalcea

Reporter

Vlad Mihalcea

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.0

Priority

Major