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

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


The following commit(s) were added to refs/heads/STABLE-4.2 by this push:
     new a97b04d33 CAY-2783 DbEntity to ObjEntity synchronization should check 
mandatory flag for primitive java types
a97b04d33 is described below

commit a97b04d33265faf28f0ece0f907e0eb569ab4c0c
Author: Nikita Timofeev <[email protected]>
AuthorDate: Mon Dec 5 18:18:47 2022 +0300

    CAY-2783 DbEntity to ObjEntity synchronization should check mandatory flag 
for primitive java types
    
    (cherry picked from commit bd0bf2687b373704bcb53997fc98e626f4a6c164)
---
 RELEASE-NOTES.txt                                                       | 1 +
 .../org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java     | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 9be7ae607..bb7b9458a 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -15,6 +15,7 @@ Changes/New Features:
 
 Bug Fixes:
 
+CAY-2783 DbEntity to ObjEntity synchronization should check mandatory flag for 
primitive java types
 
 ----------------------------------
 Release: 4.2.RC2
diff --git 
a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java
 
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java
index 726e3efc1..d71a38fad 100644
--- 
a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java
+++ 
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java
@@ -311,7 +311,7 @@ public class EntityMergeSupport {
 
         String type = TypesMapping.getJavaBySqlType(dbAttribute);
         String primitiveType;
-        if (usingPrimitives && (primitiveType = CLASS_TO_PRIMITIVE.get(type)) 
!= null) {
+        if (usingPrimitives && dbAttribute.isMandatory() && (primitiveType = 
CLASS_TO_PRIMITIVE.get(type)) != null) {
             return primitiveType;
         }
         return type;

Reply via email to