Files
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

62 lines
1.7 KiB
Plaintext

-- DDL generated by Hibernate 7.4.13.Final for H2, strategy JOINED
-- tables created: 5
create sequence jn_order_seq start with 1 increment by 50;
create sequence jn_payment_seq start with 1 increment by 50;
create table jn_bank_transfer_payment (
payment_id bigint not null,
bank_code varchar(11),
iban varchar(34) not null,
primary key (payment_id)
);
create table jn_card_payment (
card_last4 varchar(4) not null,
payment_id bigint not null,
network varchar(16),
primary key (payment_id)
);
create table jn_order (
id bigint not null,
payment_id bigint not null,
reference varchar(20) not null,
primary key (id)
);
create table jn_payment (
amount numeric(12,2) not null,
currency varchar(3) not null,
id bigint not null,
primary key (id)
);
create table jn_wallet_payment (
payment_id bigint not null,
provider varchar(24) not null,
primary key (payment_id)
);
alter table if exists jn_bank_transfer_payment
add constraint FK7mx6hp714jwtc7cbp5oboi9b5
foreign key (payment_id)
references jn_payment;
alter table if exists jn_card_payment
add constraint FK2pe4xdfpn9xujq97a21nj00nr
foreign key (payment_id)
references jn_payment;
alter table if exists jn_order
add constraint FKschxw26qcnlfcgeyirv55ttkl
foreign key (payment_id)
references jn_payment;
alter table if exists jn_wallet_payment
add constraint FK9cf00xcddbti8l83t1s5ptu3h
foreign key (payment_id)
references jn_payment;