1
0
Files
hibernate-demo/scripts/run-all.sh
Ankur Mhatre 7b06d653e4 Add hibernate-demo: get() vs load(), merge() vs refresh(), inserting objects (Hibernate 7.4.1.Final + Spring Boot 4.1.0)
Adds a JUnit test suite (GetVsGetReferenceTest, MergeRefreshTest, OptimisticLockTest,
IdentityBatchTest, SequenceBatchTest, AllocationSizeSweepTest, BatchSizeSweepTest) so every
surprising behavior described in the three companion posts has a reproducible test, alongside
the original CommandLineRunner scenarios. Rewrites all three doc chapters and the README around
the new experiments: the get()/getReference() same-session matrix, the merge()/refresh()
experiments (including exactly when OptimisticLockException surfaces and a corrected LAZY-plus-
cascade merge() result), and two new sweeps (allocationSize, batch_size) for batch inserts.
2026-08-26 18:05:00 +00:00

28 lines
996 B
Bash
Executable File

#!/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