如何在JPA / Hibernate映射中模拟以下模型
CREATE TABLE "IRIS"."SME_ANCHOR"
( "NAME" VARCHAR2(250 CHAR),
"REPORT_PKID" VARCHAR2(32 CHAR),
"PKID" VARCHAR2(32 CHAR),
"INDUSTRY_CODE" VARCHAR2(250 CHAR),
"ACTIVE_FLAG" VARCHAR2(50 CHAR),
"PORTFOLIO_PKID" VARCHAR2(32 CHAR),
"POSTAL_CODE" VARCHAR2(250 CHAR),
"CITY" VARCHAR2(250 CHAR)
)
ALTER TABLE "IRIS"."SME_ANCHOR" ADD CONSTRAINT "SAR_PK" PRIMARY KEY ("PKID", "ACTIVE_FLAG")
CREATE TABLE "IRIS"."LOAN_SME"
( "SME_ANCHOR_PKID" VARCHAR2(32 CHAR),
"LOAN_ANCHOR_PKID" VARCHAR2(32 CHAR),
"ACTIVE_FLAG" VARCHAR2(50 CHAR)
)
ALTER TABLE "IRIS"."LOAN_SME" ADD CONSTRAINT "PK_LOAN_SME" PRIMARY KEY ("SME_ANCHOR_PKID", "ACTIVE_FLAG", "LOAN_ANCHOR_PKID")
CREATE TABLE "IRIS"."LOAN_ANCHOR"
( "LOAN_ID_STRD" VARCHAR2(240 CHAR),
"PORTFOLIO_PKID" VARCHAR2(32 CHAR),
"REPORT_PKID" VARCHAR2(32 CHAR),
"STATUS" VARCHAR2(250 CHAR),
"CURRENCY" VARCHAR2(250 CHAR),
"PURPOSE" VARCHAR2(253 CHAR),
"PKID" VARCHAR2(32 CHAR),
"ACTIVE_FLAG" VARCHAR2(50 CHAR),
)
ALTER TABLE "IRIS"."LOAN_ANCHOR" ADD CONSTRAINT "LAR_PK" PRIMARY KEY ("PKID", "ACTIVE_FLAG")
这里的难点在于模型化具有由2个元素组成的键的实体和由3个元素组成的外键。 我该怎么解决这个问题。 我正在尝试@ManyToMany协会,但没有成功。 任何帮助都会很感激。