DEV Community

Igor Rudel
Igor Rudel

Posted on

3 1 1

Spring Boot 3 + Hibernate: Logando undefined/unknown

A partir de uma certa versão do Spring Boot 3, utilizando JPA o Hibernate adicionou os seguintes log's:

org.hibernate.orm.connections.pooling    : HHH10001005: Database info:
    Database JDBC URL [Connecting through datasource 'HikariDataSource (HikariPool-1)']
    Database driver: undefined/unknown
    Database version: 2.3.232
    Autocommit mode: undefined/unknown
    Isolation level: undefined/unknown
    Minimum pool size: undefined/unknown
    Maximum pool size: undefined/unknown
Enter fullscreen mode Exit fullscreen mode

Para que essas informações venham populadas é necessário definir 2 propriedades:

spring.jpa.hibernate.ddl-auto
spring.jpa.properties.hibernate.connection.url
Enter fullscreen mode Exit fullscreen mode

A spring.jpa.properties.hibernate.connection.url populada:

spring.jpa.properties.hibernate.connection.url=${spring.datasource.url}
Enter fullscreen mode Exit fullscreen mode

O resultado será parecido com este:

org.hibernate.orm.connections.pooling    : HHH10001005: Database info:
    Database JDBC URL [jdbc:h2:mem:db;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA test\;]
    Database driver: org.h2.Driver
    Database version: 2.3.232
    Autocommit mode: false
    Isolation level: undefined/unknown
    Minimum pool size: 1
    Maximum pool size: 20
Enter fullscreen mode Exit fullscreen mode

Outras 3 propriedades que alteram as configurações da conexão/datasource:

spring.jpa.properties.hibernate.connection.autocommit
spring.jpa.properties.hibernate.connection.isolation
spring.jpa.properties.hibernate.connection.pool_size
Enter fullscreen mode Exit fullscreen mode

Na propriedade spring.jpa.properties.hibernate.connection.isolation os possíveis valores são: TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED, TRANSACTION_REPEATABLE_READ ou TRANSACTION_SERIALIZABLE

Top comments (0)