Hi. After upgrading from 5.2 to Hibernate 6.2 and SpringBoot 3.1.2 with an underlying PostgresDB, we are experiencing some really long execution times of our integration tests. After an examination of the logs we noticed that the there are some SQL errors being thrown in the test, both before and after the upgrade. But before the upgrade it was handled this way:
13:44:40.376 [Test worker] WARN o.h.e.jdbc.spi.SqlExceptionHelper - SQL Error: 0, SQLState: 23P01
13:44:40.376 [Test worker] ERROR o.h.e.jdbc.spi.SqlExceptionHelper - ERROR: conflicting key value violates exclusion constraint "XXX" Detail: XXX
13:44:40.377 [Test worker] INFO o.h.e.j.b.internal.AbstractBatchImpl - HHH000010: On release of batch it still contained JDBC statements
13:44:40.382 [Test worker] INFO o.s.t.c.t.TransactionContext - Rolled back transaction for test XXX
REPEATED MULTIPLE TIMES
And after the upgrade it seems the transactions are being kept alive and block the execution of further tests since no rollback statements are present:
12:53:51.064 [Test worker] WARN o.h.e.jdbc.spi.SqlExceptionHelper - SQL Error: 0, SQLState: 23P01
12:53:51.064 [Test worker] ERROR o.h.e.jdbc.spi.SqlExceptionHelper - ERROR: conflicting key value violates exclusion constraint "XXX" Detail: XXX
12:53:55.458 [vert.x-eventloop-thread-0] WARN io.grpc.netty.NettyClientHandler - Received GOAWAY with ENHANCE_YOUR_CALM. Debug data: too_many_pings
12:53:55.459 [vert.x-eventloop-thread-0] WARN io.grpc.internal.AtomicBackoff - Increased keepalive time nanos to 60,000,000,000
12:54:06.923 [Test worker] WARN o.h.e.jdbc.spi.SqlExceptionHelper - SQL Error: 0, SQLState: 23P01
Do you have any idea which configuration is responsible for this? I assume some default has changed and now I need to set it explicitly to get the previous behaviour?
If this is not something that can be easily configured, what is the best practice here? I thought about a fallback in @AfterEach but a session seems to have no method for rolling back all pending transactions?
In case it is relevant, our configuration looks like this:
spring:
sql:
init:
platform: postgresql
main:
allow-bean-definition-overriding: true
lazy-initialization: true
test:
database:
replace: none
cache:
type: none
flyway:
enabled: true
jpa:
properties:
dialect: org.hibernate.dialect.PostgreSQLDialect
hibernate:
id:
db_structure_naming_strategy: legacy
database: POSTGRESQL
hibernate:
ddl-auto: validate
open-in-view: false
datasource:
hikari:
minimum-idle: 30
maximum-pool-size: 30