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:
@@ -0,0 +1,20 @@
|
||||
INDICATIVE ONLY - timings drift between runs and machines; nothing here is asserted.
|
||||
Hibernate 7.4.13.Final, H2 in memory, JDK 25.0.5+8-LTS, 2 vCPU
|
||||
150000 payments (50000 card, 50000 bank transfer, 50000 wallet), read through a StatelessSession, median of 15 runs after 5 warm-ups
|
||||
|
||||
strategy query rows median ms
|
||||
single-table all payments (polymorphic) 150000 247.2
|
||||
single-table one subclass (CardPayment) 50000 82.4
|
||||
single-table count where amount > 500 (root col) 1 18.4
|
||||
single-table first 50 by id (polymorphic) 50 0.3
|
||||
|
||||
joined all payments (polymorphic) 150000 401.5
|
||||
joined one subclass (CardPayment) 50000 107.1
|
||||
joined count where amount > 500 (root col) 1 21.6
|
||||
joined first 50 by id (polymorphic) 50 0.3
|
||||
|
||||
table-per-class all payments (polymorphic) 150000 422.0
|
||||
table-per-class one subclass (CardPayment) 50000 82.1
|
||||
table-per-class count where amount > 500 (root col) 1 56.0
|
||||
table-per-class first 50 by id (polymorphic) 50 165.8
|
||||
|
||||
Reference in New Issue
Block a user