From 7ce7e556207f545a7bd688d4d8491a3021fa3aac Mon Sep 17 00:00:00 2001 From: Pinaki Poddar Date: Tue, 19 Feb 2013 20:33:15 +0000 Subject: [PATCH] OPENJPA-2335: Set non-default value to a foreign key contrained column git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1447906 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/openjpa/jdbc/sql/PrimaryRow.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PrimaryRow.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PrimaryRow.java index 04cb56fef..5270142c1 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PrimaryRow.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PrimaryRow.java @@ -338,9 +338,9 @@ public class PrimaryRow if (prev == NULL) prev = null; if (!rowValueEquals(prev, val)) { - if (allowsUpdate(col, prev, val)) { + if (isDefaultValue(prev) || allowsUpdate(col, prev, val)) { super.setObject(col, val, metaType, overrideDefault); - } else if (!isDefaultValue(val)) { + } else if (!isDefaultValue(prev)) { throw new InvalidStateException(_loc.get("diff-values", new Object[]{ col.getFullDBIdentifier().getName(), (prev == null) ? null : prev.getClass(), prev,