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
+38
View File
@@ -0,0 +1,38 @@
import re, sys, os
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DOCS = os.path.join(ROOT, "docs")
link_re = re.compile(r'\[[^\]]*\]\(([^)]+)\)')
errors = []
checked = 0
for dirpath, _, filenames in os.walk(DOCS):
for fn in filenames:
if not fn.endswith(".md"):
continue
path = os.path.join(dirpath, fn)
with open(path, encoding="utf-8") as f:
content = f.read()
for m in link_re.finditer(content):
target = m.group(1).strip()
if target.startswith(("http://", "https://", "mailto:")):
continue
# strip fragment
target_path = target.split("#", 1)[0]
if not target_path:
continue
resolved = os.path.normpath(os.path.join(dirpath, target_path))
checked += 1
if not os.path.exists(resolved):
errors.append(f"{os.path.relpath(path, ROOT)}: broken link -> {target} (resolved: {os.path.relpath(resolved, ROOT)})")
print(f"Checked {checked} relative links across docs/*.md")
if errors:
print(f"\n{len(errors)} BROKEN LINK(S):")
for e in errors:
print(" " + e)
sys.exit(1)
else:
print("All relative links resolve to existing files.")
+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/env python3
"""Turn a raw mvn spring-boot:run capture into a clean, reproducible transcript.
Strips JVM/build noise (sun.misc.Unsafe warnings, JAVA_TOOL_OPTIONS proxy banners) and the
duplicate un-prefixed echo of each SQL statement that org.hibernate.SQL's show_sql=true prints
to stdout in addition to the "Hibernate: ..." line the logger emits -- same text twice, so only
the logger-prefixed copy is kept.
"""
import re
import sys
DROP_PREFIXES = (
"WARNING:",
"Picked up JAVA_TOOL_OPTIONS",
)
def clean(lines):
out = []
for line in lines:
stripped = line.rstrip("\n")
if any(stripped.startswith(p) for p in DROP_PREFIXES):
continue
# Drop the bare SQL echo line that show_sql=true prints without the "Hibernate: " prefix
# -- it is always immediately followed by the same text WITH the prefix.
out.append(stripped)
deduped = []
i = 0
while i < len(out):
cur = out[i]
nxt = out[i + 1] if i + 1 < len(out) else None
if nxt is not None and nxt == "Hibernate: " + cur:
i += 1 # skip the bare echo, keep the prefixed one on the next iteration
continue
deduped.append(out[i])
i += 1
return deduped
if __name__ == "__main__":
src, dst = sys.argv[1], sys.argv[2]
with open(src, encoding="utf-8") as f:
lines = f.readlines()
cleaned = clean(lines)
with open(dst, "w", encoding="utf-8") as f:
f.write("\n".join(cleaned) + "\n")
print(f"{src}: {len(lines)} -> {dst}: {len(cleaned)} lines")
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Regenerate every file in docs/output/ from a real run. This is the script referenced by
# "regenerated by one command" in the post and the README -- if it stops producing the same
# shape of output, the docs are wrong until it's fixed, not the other way around.
set -eu
cd "$(dirname "$0")/.."
RAW_DIR="$(mktemp -d)"
trap 'rm -rf "$RAW_DIR"' EXIT
run_one() {
local profile="$1" outfile="$2"
echo "=== running profile: $profile ===" >&2
mvn -q -B org.springframework.boot:spring-boot-maven-plugin:run \
-Dspring-boot.run.profiles="$profile" 2>&1 \
| grep -v '^Picked up JAVA_TOOL_OPTIONS' \
| grep -v '^WARNING:' \
> "$RAW_DIR/$profile.raw.txt"
python3 scripts/clean_output.py "$RAW_DIR/$profile.raw.txt" "docs/output/$outfile"
}
run_one getvsload get-vs-load.txt
run_one mergerefresh merge-vs-refresh.txt
run_one insert-identity insert-identity.txt
run_one insert-sequence insert-sequence.txt
echo "docs/output/ regenerated." >&2
Executable
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Run one scenario in the foreground and exit.
#
# ./scripts/run.sh getvsload
# ./scripts/run.sh mergerefresh
# ./scripts/run.sh insert-identity
# ./scripts/run.sh insert-sequence
#
# Every scenario here is a CommandLineRunner against an in-memory H2 database with
# spring.main.web-application-type=none, so there is no server to keep alive and nothing to
# kill afterwards -- the process runs the scenario and exits on its own.
set -eu
PROFILE="${1:?usage: run.sh <getvsload|mergerefresh|insert-identity|insert-sequence>}"
cd "$(dirname "$0")/.."
mvn -q -B org.springframework.boot:spring-boot-maven-plugin:run \
-Dspring-boot.run.profiles="$PROFILE"