You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2026/09/10 09:47:12 UTC

(empire-db) branch master updated: EMPIREDB-497 DBRowSet:updateRecord: allow nullable primary key columns.

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

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/empire-db.git


The following commit(s) were added to refs/heads/master by this push:
     new b18315bd EMPIREDB-497 DBRowSet:updateRecord: allow nullable primary key columns.
b18315bd is described below

commit b18315bdef71630bb5b2522047034d9a73cf7b69
Author: Rainer Döbele <do...@apache.org>
AuthorDate: Thu Sep 10 11:47:05 2026 +0200

    EMPIREDB-497
    DBRowSet:updateRecord: allow nullable primary key columns.
---
 empire-db/src/main/java/org/apache/empire/db/DBRowSet.java | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/empire-db/src/main/java/org/apache/empire/db/DBRowSet.java b/empire-db/src/main/java/org/apache/empire/db/DBRowSet.java
index 48f88eb5..a5e94560 100644
--- a/empire-db/src/main/java/org/apache/empire/db/DBRowSet.java
+++ b/empire-db/src/main/java/org/apache/empire/db/DBRowSet.java
@@ -1073,7 +1073,6 @@ public abstract class DBRowSet extends DBExpr implements Entity
         String sql = null;
         int setCount = 0;
         // Perform action
-        DBColumn[] keyColumns = getKeyColumns();
         DBRecordBase.State recordState = record.getState(); 
         if (recordState==DBRecordBase.State.New)
         {	// Insert Record
@@ -1115,10 +1114,6 @@ public abstract class DBRowSet extends DBExpr implements Entity
                     cmd.set(col.to(value));
                     setCount++;
                 }
-                else if (ObjectUtils.contains(keyColumns, col))
-                {   // All primary key fields must be supplied
-                    throw new FieldNotNullException(col);
-                }
                 else if (col.isRequired())
                 {   // Error Column is required!
                     throw new FieldNotNullException(col);
@@ -1128,6 +1123,7 @@ public abstract class DBRowSet extends DBExpr implements Entity
         }
         else if (recordState==DBRecordBase.State.Modified)
         {	// Update Record
+            DBColumn[] keyColumns = getKeyColumns();
             if (keyColumns == null)
             { // Requires a primary key
                 log.error("updateRecord: {} no primary key defined!", name);