Add Hibernate 7 batches 2-6, batch 7, and batch 8: mapping styles, JPA annotations, natural IDs, @Immutable, stored procedures, in-memory test databases, JNDI mocking, proxies, associations, temporal mapping, named queries, HQL, Criteria API, EntityManager bootstrapping, Ehcache 3 L2 cache configuration, HikariCP connection pooling, Hibernate Validator CDI integration, aggregate functions, sorting, pagination, interceptors, and Hibernate Search 8 (Hibernate 7.4.5.Final + Spring Boot 4.1.1 + JDK 25)

This commit is contained in:
2026-09-20 06:06:42 +00:00
committed by Claude
commit 8568c0ce6c
330 changed files with 23668 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
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"