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.
21 lines
1.3 KiB
Plaintext
21 lines
1.3 KiB
Plaintext
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
|
|
|