Files
spring-lifecycle-smoke-tests/data/data-jpa
2024-06-14 18:29:28 +02:00
..
2023-09-22 10:12:57 +02:00

Tests and documentation for Spring Data JPA with Hibernate and HikariCP.

== Prevent early database interaction

Non-embedded databases require extra configuration to avoid Hibernate to contact the remote database before the refresh phase:
```
# Specify explicitly the dialect (here for PostgreSQL, adapt for your database)
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect

# Disable Hibernate usage of JDBC metadata
spring.jpa.properties.hibernate.boot.allow_jdbc_metadata_access=false

# Database initialization should typically be performed outside of Spring lifecycle
spring.jpa.hibernate.ddl-auto=none
spring.sql.init.mode=never
```

NOTE: The supported dialects can be found https://docs.jboss.org/hibernate/orm/6.5/userguide/html_single/Hibernate_User_Guide.html#compatibility-database[here].

NOTE: With Spring Boot 3.2 / Hibernate 6.4 and earlier, use `spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false` instead
of `spring.jpa.properties.hibernate.boot.allow_jdbc_metadata_access=false`.

=== JVM Checkpoint Restore

In order to allow checkpoint/restore to work as expected, Hikari pool suspension should be enabled:

```
spring.datasource.hikari.allow-pool-suspension=true
```