Add inheritance module: SINGLE_TABLE vs JOINED vs TABLE_PER_CLASS on Hibernate 7.4.13.Final

Same payment hierarchy mapped three ways plus @MappedSuperclass, run with plain Hibernate on H2.
Tests assert and write the generated DDL, the INSERT/SELECT SQL, row/insert/FK/nullability counts and
the three failures (NOT NULL on a SINGLE_TABLE subclass column, IDENTITY with TABLE_PER_CLASS, querying a
@MappedSuperclass); Bench writes indicative polymorphic-query timings. No docs folder: depth lives in the post.
This commit is contained in:
2026-10-24 10:02:28 +00:00
parent 833f3e1c31
commit 807f681ed1
44 changed files with 1533 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Writes output/04-polymorphic-timings.txt. Timings are indicative: they drift between runs and machines.
set -euo pipefail
cd "$(dirname "$0")/.."
mvn -B -q test-compile dependency:build-classpath -Dmdep.outputFile=target/cp.txt -Dmdep.includeScope=test
java -cp "target/classes:target/test-classes:$(cat target/cp.txt)" com.ankurm.inheritance.Bench
cat output/04-polymorphic-timings.txt
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Regenerates every file under output/. Needs JDK 25 and Maven 3.9 with access to Maven Central.
# 01-ddl-*, 02-sql-*, 03-contracts : the JUnit tests (they assert the numbers they print)
# 04-polymorphic-timings : scripts/bench.sh (indicative timings, not asserted)
set -euo pipefail
cd "$(dirname "$0")/.."
mvn -B clean test
./scripts/bench.sh
ls -1 output