2
我怎樣才能hibernate
O表,其主鍵也是外鍵使用PK的FK在JPA /休眠
因爲此架構模式:
CREATE TABLE policies (
policy_id int,
date_issued datetime,
-- // other common attributes ...
);
CREATE TABLE policy_motor (
policy_id int,
vehicle_reg_no varchar(20),
-- // other attributes specific to motor insurance ...
FOREIGN KEY (policy_id) REFERENCES policies (policy_id)
);
CREATE TABLE policy_property (
policy_id int,
property_address varchar(20),
-- // other attributes specific to property insurance ...
FOREIGN KEY (policy_id) REFERENCES policies (policy_id)
);
- 這是可能的hibernate映射還是最好的是分開 他們並使用新的PK?
- 並且如果我在主表上使用自動遞增當然
「@ MapsId」是什麼意思? – Youssef 2015-02-06 11:03:55
檢查我的更新答案。 – 2015-02-06 11:13:46
感謝人,它真的幫助我,因爲我使用hibernate工具,它生成了一個額外的表與@Embeddable的東西。 – Youssef 2015-02-06 11:33:55