New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support overlapping embeddables when enabling <embeddablePrimaryKeys/> #15828
Comments
Thanks for your report. Can you provide a minimal reproducer for this warning (minimal DDL and code generation configuration)? I'm not sure, otherwise, if this warning is legitimate or not. Note, our MCVE template now also has an Oracle version: https://github.com/jOOQ/jOOQ-mcve, though perhaps, just DDL and codegen config will suffice in this case. |
I created an MVCE and pushed to Github. The problem is trivially reproducible. The following schema causes the warning to be logged when you turn on embeddablePrimaryKeys: CREATE TABLE "INSTITUSJON"
(
"INSTITUSJONSNR" NUMBER(8,0) NOT NULL ENABLE,
CONSTRAINT "I01_INSTITUSJON" PRIMARY KEY ("INSTITUSJONSNR")
);
CREATE TABLE "EMNE"
(
"INSTITUSJONSNR_EIER" NUMBER(8,0) NOT NULL ENABLE,
"INSTITUSJONSNR" NUMBER(8,0) NOT NULL ENABLE,
"EMNEKODE" VARCHAR2(12 CHAR) NOT NULL ENABLE,
"VERSJONSKODE" VARCHAR2(3 CHAR) NOT NULL ENABLE,
"EMNENAVNFORK" VARCHAR2(20 CHAR) NOT NULL ENABLE,
"EMNENAVN_BOKMAL" VARCHAR2(120 CHAR) NOT NULL ENABLE,
CONSTRAINT "I01_EMNE" PRIMARY KEY ("INSTITUSJONSNR_EIER", "INSTITUSJONSNR", "EMNEKODE", "VERSJONSKODE"),
CONSTRAINT "INSTITUSJON_EMNE" FOREIGN KEY ("INSTITUSJONSNR")
REFERENCES "INSTITUSJON" ("INSTITUSJONSNR") DEFERRABLE ENABLE
); |
Thanks a lot! I will look at it soon. |
I can reproduce this warning:
And this compilation error:
|
This looks like one of the known issues from here: Which reads:
There are no tests for this scenario yet. Two things need to be done here:
Perhaps, the warning could be improved to make it clear that this isn't supported (yet), in case it's hard to implement correctly. |
It's not strictly the same as the improvement requested in #11975. We already support overlapping embeddables (without nesting them), e.g. |
Hmm, weird. There already is an integration test: CREATE TABLE s_composite_key.t_composite_key_3 (
i BIGINT NOT NULL,
v INT NOT NULL,
CONSTRAINT pk_t_composite_key_3 PRIMARY KEY (i)
);
CREATE TABLE s_composite_key.t_composite_key_4 (
j BIGINT NOT NULL,
k BIGINT NOT NULL,
v INT NOT NULL,
CONSTRAINT pk_t_composite_key_4 PRIMARY KEY (j, k)
);
CREATE TABLE s_composite_key.t_composite_key_5 (
i BIGINT NOT NULL,
j BIGINT NOT NULL,
k BIGINT NOT NULL,
v INT NOT NULL,
CONSTRAINT pk_t_composite_key_5 PRIMARY KEY (i, j, k),
CONSTRAINT fk_t_composite_key_5_to_3 FOREIGN KEY (i) REFERENCES s_composite_key.t_composite_key_3,
CONSTRAINT fk_t_composite_key_5_to_4 FOREIGN KEY (j, k) REFERENCES s_composite_key.t_composite_key_4
); It produces the warning, but not the compilation error. I can reproduce the error with this test, though: CREATE TABLE s_keys_containing_references.t_keys_containing_references_parent (
a INT NOT NULL,
CONSTRAINT pk_t_keys_containing_references_parent PRIMARY KEY (a)
);
CREATE TABLE s_keys_containing_references.t_keys_containing_references_child (
a INT NOT NULL,
b INT NOT NULL,
CONSTRAINT pk_t_keys_containing_references_child PRIMARY KEY (a, b),
CONSTRAINT fk_t_keys_containing_references_child FOREIGN KEY (a) REFERENCES s_keys_containing_references.t_keys_containing_references_parent
); |
Removing |
The problem is that |
Fixed in versions:
Thanks again for your report! |
Expected behavior
No response
Actual behavior
Lots of
[WARNING] Embeddable ambiguity : There are multiple embeddables
like the following (line broken down for readability):While the tables in question are quite large, I believe the important part here is that:
Am I missing something here?
The tables in question are views and the constraints are virtual in case that matters.
Steps to reproduce the problem
The problem appears when enabling the following setting under
database
, as per https://www.jooq.org/doc/latest/manual/code-generation/codegen-embeddable-types/codegen-embedded-keys/<embeddablePrimaryKeys>.*</embeddablePrimaryKeys>
jOOQ Version
3.18.6
Database product and version
Oracle 18 XE
Java Version
No response
OS Version
No response
JDBC driver name and version (include name if unofficial driver)
No response
The text was updated successfully, but these errors were encountered: