Код IT
← Каталог

Работа с базами данных из Java — Настройка Hibernate

Фрагмент из «Работа с базами данных из Java»: Настройка Hibernate.

Plain text main.properties
# Включить генерацию схемы (только для dev!)
spring.jpa.hibernate.ddl-auto=validate

# Включить логгирование SQL (не в промышленной эксплуатации)
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true

# Пул соединений (HikariCP управляется отдельно)
spring.datasource.hikari.maximum-pool-size=20

# Hibernate-specific
spring.jpa.properties.hibernate.jdbc.batch_size=20
spring.jpa.properties.hibernate.order_inserts=true
spring.jpa.properties.hibernate.order_updates=true
spring.jpa.properties.hibernate.cache.use_second_level_cache=true
spring.jpa.properties.hibernate.cache.region.factory_class=jcache
# Включить генерацию схемы (только для dev!)
spring.jpa.hibernate.ddl-auto=validate

# Включить логгирование SQL (не в промышленной эксплуатации)
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true

# Пул соединений (HikariCP управляется отдельно)
spring.datasource.hikari.maximum-pool-size=20

# Hibernate-specific
spring.jpa.properties.hibernate.jdbc.batch_size=20
spring.jpa.properties.hibernate.order_inserts=true
spring.jpa.properties.hibernate.order_updates=true
spring.jpa.properties.hibernate.cache.use_second_level_cache=true
spring.jpa.properties.hibernate.cache.region.factory_class=jcache