You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2022/11/24 15:13:36 UTC

[cayenne] 02/02: CAY-2781 Enable 'Create PK properties' by default in the cgen configuration

This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit f732f18442179d66a45e62842eaa7db3a1009190
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Thu Nov 24 18:13:28 2022 +0300

    CAY-2781 Enable 'Create PK properties' by default in the cgen configuration
---
 RELEASE-NOTES.txt                                              |  1 +
 .../main/java/org/apache/cayenne/gen/CgenConfiguration.java    | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 2c3510f85..80bbaf38b 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -33,6 +33,7 @@ CAY-2767 Modeler: upgrade deprecated code in custom components
 CAY-2773 Switch master to "5.0"
 CAY-2776 Upgrade Gradle to 7.6
 CAY-2780 Modeler: Multiple configurations for classes generation
+CAY-2781 Enable 'Create PK properties' by default in the cgen configuration
 
 Bug Fixes:
 
diff --git a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/CgenConfiguration.java b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/CgenConfiguration.java
index 221b1adff..92a827735 100644
--- a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/CgenConfiguration.java
+++ b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/CgenConfiguration.java
@@ -93,21 +93,21 @@ public class CgenConfiguration implements Serializable, XMLSerializable {
 
     public CgenConfiguration() {
         this.name = CgenConfigList.DEFAULT_CONFIG_NAME;
-        /*
+        /**
          * {@link #isDefault()} method should be in sync with the following values
          */
         this.outputPattern = "*.java";
         this.timestamp = 0L;
         this.usePkgPath = true;
         this.makePairs = true;
-        setArtifactsGenerationMode("entity");
+        this.createPKProperties = true;
+        this.artifactsGenerationMode = ArtifactsGenerationMode.ENTITY;
 
         this.artifacts = new ArrayList<>();
         this.entityArtifacts = new HashSet<>();
         this.excludeEntityArtifacts = new ArrayList<>();
         this.embeddableArtifacts = new HashSet<>();
         this.excludeEmbeddableArtifacts = new ArrayList<>();
-        this.artifactsGenerationMode = ArtifactsGenerationMode.ENTITY;
 
         this.template = TemplateType.ENTITY_SUBCLASS.defaultTemplate();
         this.superTemplate = TemplateType.ENTITY_SUPERCLASS.defaultTemplate();
@@ -446,10 +446,10 @@ public class CgenConfiguration implements Serializable, XMLSerializable {
      */
     public boolean isDefault() {
         // this must be is sync with actual default values
-        return isMakePairs()
+        return makePairs
                 && usePkgPath
                 && !overwrite
-                && !createPKProperties
+                && createPKProperties
                 && !createPropertyNames
                 && "*.java".equals(outputPattern)
                 && template.equals(TemplateType.ENTITY_SUBCLASS.defaultTemplate())