Files
hibernate-demo/src/main/resources/application.yml
T

59 lines
2.3 KiB
YAML
Executable File

spring:
main:
web-application-type: none
banner-mode: off
datasource:
url: jdbc:h2:mem:hibernate-demo;DB_CLOSE_DELAY=-1
driver-class-name: org.h2.Driver
username: sa
password:
jpa:
hibernate:
ddl-auto: update
open-in-view: false
properties:
hibernate:
show_sql: true
format_sql: false
use_sql_comments: true
generate_statistics: true
# Pinned OFF deliberately. hibernate-jcache is on this project's classpath (the
# natural-id L2 chapter needs it), and Hibernate 7.4.5 will resolve a RegionFactory
# through the service loader and turn the second-level cache ON by itself when it
# finds one -- with nothing configured here. That is fine until a standalone test
# closes the shared Ehcache CacheManager, at which point unrelated Spring tests fail
# their commit with "Cache[...] is closed". See docs/output/testdb-jcache-classpath-pollution.txt
# and JCacheOnClasspathAutoEnablesL2Test, which pins the auto-enable down.
cache:
use_second_level_cache: false
jdbc:
batch_size: 25
order_inserts: true
order_updates: true
search:
# Chapter 25's @Indexed entity (com.ankurm.hibernatedemo.search.Movie) lives under
# this application's normally-scanned package tree, so Hibernate Search bootstraps
# for EVERY test in this repo that boots the shared HibernateDemoApplication context,
# not only chapter 25's own tests -- confirmed the hard way: adding @Indexed here with
# zero backend configuration broke every other @SpringBootTest in the whole suite,
# because Hibernate Search has no backend to start against otherwise. "target/" is
# writable, gets removed by `mvn clean`, and Spring's test-context caching means this
# backend starts exactly once per test JVM, not once per test class.
backend:
type: lucene
directory:
root: target/lucene-indexes
schema_management:
strategy: drop-and-create
logging:
level:
root: WARN
DEMO: INFO
org.hibernate.SQL: DEBUG
org.hibernate.orm.jdbc.bind: TRACE
org.hibernate.engine.jdbc.batch.internal.BatchingBatch: DEBUG
org.hibernate.stat: INFO
pattern:
console: "%msg%n"