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 b00bd9a32 CAY-2896 Inserting two identical objects into two datamaps 
stores both objects in the last used datamap  - release notes and minor cleaup
b00bd9a32 is described below

commit b00bd9a32981d7f5b314d0fa43184ccc2ddcb5d2
Author: Nikita Timofeev <[email protected]>
AuthorDate: Wed Sep 24 18:17:32 2025 +0400

    CAY-2896 Inserting two identical objects into two datamaps stores both 
objects in the last used datamap
     - release notes and minor cleaup
---
 RELEASE-NOTES.txt                                        |  1 +
 .../cayenne/access/flush/operation/BaseDbRowOp.java      | 16 +++++++---------
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index a8cb56526..9184e5d09 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -20,6 +20,7 @@ Bug Fixes:
 
 CAY-2883 License and notice templates are not processed by the Gradle build
 CAY-2885 Modeler: DbImport fails to load DB schema view
+CAY-2896 Inserting two identical objects into two datamaps stores both objects 
in the last used datamap
 
 ----------------------------------
 Release: 4.2.2
diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/access/flush/operation/BaseDbRowOp.java
 
b/cayenne-server/src/main/java/org/apache/cayenne/access/flush/operation/BaseDbRowOp.java
index e5c40198e..2eedfe9e6 100644
--- 
a/cayenne-server/src/main/java/org/apache/cayenne/access/flush/operation/BaseDbRowOp.java
+++ 
b/cayenne-server/src/main/java/org/apache/cayenne/access/flush/operation/BaseDbRowOp.java
@@ -77,15 +77,13 @@ public abstract class BaseDbRowOp implements DbRowOp {
         return entity.getName() + " " + changeId;
     }
 
+    /**
+     * Internal check used in the batching ops logic
+     * @param rowOp to compare with
+     * @return true if another op has the same entity name and datamap
+     */
     protected boolean entitiesHaveSameNameAndDataMap(DbRowOp rowOp) {
-        return entitiesHaveSameName(rowOp) && entitiesHaveSameDataMap(rowOp);
-    }
-
-    boolean entitiesHaveSameName(DbRowOp rowOp) {
-        return rowOp.getEntity().getName().equals(getEntity().getName());
-    }
-
-    private boolean entitiesHaveSameDataMap(DbRowOp rowOp) {
-        return 
rowOp.getEntity().getDataMap().getName().equals(getEntity().getDataMap().getName());
+        return getEntity().getName().equals(rowOp.getEntity().getName())
+                && 
getEntity().getDataMap().getName().equals(rowOp.getEntity().getDataMap().getName());
     }
 }

Reply via email to