Skip to content
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

Unstable ordering of Derby generated foreign keys #14938

Closed
lukaseder opened this issue Apr 14, 2023 · 1 comment
Closed

Unstable ordering of Derby generated foreign keys #14938

lukaseder opened this issue Apr 14, 2023 · 1 comment

Comments

@lukaseder
Copy link
Member

The Derby code generation output is unstable for this test table:

CREATE TABLE x_test_case_2025 (
  ref_id int NOT NULL,
  ref_name VARCHAR(10) NOT NULL,
  
  CONSTRAINT fk_x_test_case_2025_1 FOREIGN KEY(ref_id) REFERENCES x_test_case_85(ID),
  CONSTRAINT fk_x_test_case_2025_2 FOREIGN KEY(ref_id) REFERENCES x_test_case_71(ID),
  CONSTRAINT fk_x_test_case_2025_3 FOREIGN KEY(ref_id, ref_name) REFERENCES X_UNUSED(id, name)
)

Our new CI bot keeps checking in new versions of the file even if nothing has changed:

From e890c00f11a05d9e33e065dcbf031727606e5d58 Mon Sep 17 00:00:00 2001
From: Data Geekery CI Bot <ci@datageekery.com>
Date: Fri, 14 Apr 2023 07:00:49 +0200
Subject: [PATCH] [#301] Re-generated code

---
 .../tables/XTestCase_2025.java                | 24 +++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/jOOQ-test-integration/src/test/java/org/jooq/test/derby/generatedclasses/tables/XTestCase_2025.java b/jOOQ-test-integration/src/test/java/org/jooq/test/derby/generatedclasses/tables/XTestCase_2025.java
index 2849d986169..66f7bef0cd5 100644
--- a/jOOQ-test-integration/src/test/java/org/jooq/test/derby/generatedclasses/tables/XTestCase_2025.java
+++ b/jOOQ-test-integration/src/test/java/org/jooq/test/derby/generatedclasses/tables/XTestCase_2025.java
@@ -94,22 +94,12 @@ public Schema getSchema() {
 
     @Override
     public List<ForeignKey<XTestCase_2025Record, ?>> getReferences() {
-        return Arrays.asList(Keys.FK_X_TEST_CASE_2025_3, Keys.FK_X_TEST_CASE_2025_2, Keys.FK_X_TEST_CASE_2025_1);
+        return Arrays.asList(Keys.FK_X_TEST_CASE_2025_2, Keys.FK_X_TEST_CASE_2025_1, Keys.FK_X_TEST_CASE_2025_3);
     }
 
-    private transient XUnused _xUnused;
     private transient XTestCase_71 _xTestCase_71;
     private transient XTestCase_85 _xTestCase_85;
-
-    /**
-     * Get the implicit join path to the <code>TEST.X_UNUSED</code> table.
-     */
-    public XUnused xUnused() {
-        if (_xUnused == null)
-            _xUnused = new XUnused(this, Keys.FK_X_TEST_CASE_2025_3);
-
-        return _xUnused;
-    }
+    private transient XUnused _xUnused;
 
     /**
      * Get the implicit join path to the <code>TEST.X_TEST_CASE_71</code> table.
@@ -131,6 +121,16 @@ public XTestCase_85 xTestCase_85() {
         return _xTestCase_85;
     }
 
+    /**
+     * Get the implicit join path to the <code>TEST.X_UNUSED</code> table.
+     */
+    public XUnused xUnused() {
+        if (_xUnused == null)
+            _xUnused = new XUnused(this, Keys.FK_X_TEST_CASE_2025_3);
+
+        return _xUnused;
+    }
+
     @Override
     public XTestCase_2025 as(String alias) {
         return new XTestCase_2025(DSL.name(alias), this);
@lukaseder
Copy link
Member Author

Fixed in jOOQ 3.19.0, 3.18.4 (#14939), 3.17.13 (#14940), and 3.16.19 (#14941)

3.19 Other improvements automation moved this from To do to Done Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

1 participant