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 2020/09/17 13:42:56 UTC

[cayenne] branch pr/434 created (now 32ba2af)

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

ntimofeev pushed a change to branch pr/434
in repository https://gitbox.apache.org/repos/asf/cayenne.git.


      at 32ba2af  CAY-2641 Lazy attributes   - revert changes in DataRowUtils logic

This branch includes the following new commits:

     new 32ba2af  CAY-2641 Lazy attributes   - revert changes in DataRowUtils logic

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[cayenne] 01/01: CAY-2641 Lazy attributes - revert changes in DataRowUtils logic

Posted by nt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 32ba2af3ffb5846782ced628a79095d246d079c2
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Thu Sep 17 16:42:34 2020 +0300

    CAY-2641 Lazy attributes
      - revert changes in DataRowUtils logic
---
 .../java/org/apache/cayenne/access/DataRowUtils.java     | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DataRowUtils.java b/cayenne-server/src/main/java/org/apache/cayenne/access/DataRowUtils.java
index 768ed80..f92d2dd 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataRowUtils.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DataRowUtils.java
@@ -89,16 +89,18 @@ class DataRowUtils {
                 ObjAttribute attr = property.getAttribute();
                 String dbAttrPath = attr.getDbAttributePath();
 
+                Object value = snapshot.get(dbAttrPath);
+                property.writePropertyDirectly(object, null, value);
+
                 // note that a check "snaphsot.get(..) == null" would be incorrect in this
                 // case, as NULL value is entirely valid; still save a map lookup by
                 // checking for the null value first
-                if (snapshot.containsKey(dbAttrPath) && !attr.isLazy()) {
-                    Object value = snapshot.get(dbAttrPath);
-                    property.writePropertyDirectly(object, null, value);
-                } else if (attr.isLazy()) {
-                    property.writePropertyDirectly(object, null, new AttributeFault(property));
-                } else {
-                    isPartialSnapshot[0] = true;
+                if (value == null && !snapshot.containsKey(dbAttrPath)) {
+                    if(attr.isLazy()) {
+                        property.writePropertyDirectly(object, null, new AttributeFault(property));
+                    } else {
+                        isPartialSnapshot[0] = true;
+                    }
                 }
 
                 return true;