Files
hibernate-demo/inheritance/output/01-ddl-table-per-class.txt
T
asmhatre 807f681ed1 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.
2026-10-24 10:02:28 +00:00

41 lines
1.1 KiB
Plaintext

-- DDL generated by Hibernate 7.4.13.Final for H2, strategy TABLE_PER_CLASS
-- tables created: 4
create sequence tp_order_seq start with 1 increment by 50;
create sequence tp_payment_seq start with 1 increment by 50;
create table tp_bank_transfer_payment (
amount numeric(12,2) not null,
currency varchar(3) not null,
id bigint not null,
bank_code varchar(11),
iban varchar(34) not null,
primary key (id)
);
create table tp_card_payment (
amount numeric(12,2) not null,
card_last4 varchar(4) not null,
currency varchar(3) not null,
id bigint not null,
network varchar(16),
primary key (id)
);
create table tp_order (
id bigint not null,
payment_id bigint not null,
reference varchar(20) not null,
primary key (id)
);
create table tp_wallet_payment (
amount numeric(12,2) not null,
currency varchar(3) not null,
id bigint not null,
provider varchar(24) not null,
primary key (id)
);