openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fayw...@apache.org
Subject svn commit: r1036244 - /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java
Date Wed, 17 Nov 2010 21:55:21 GMT
Author: faywang
Date: Wed Nov 17 21:55:21 2010
New Revision: 1036244

URL: http://svn.apache.org/viewvc?rev=1036244&view=rev
Log:
OPENJPA-1890: fix NPE when an embeddable is set to a managed entity more than once

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java?rev=1036244&r1=1036243&r2=1036244&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java
Wed Nov 17 21:55:21 2010
@@ -311,8 +311,11 @@ class SingleFieldManager
             // works on external value
             if ((immediate || fmd.isEmbeddedPC())
                 && fmd.getCascadeDelete() == ValueMetaData.CASCADE_IMMEDIATE) {
-                if (fmd.isEmbeddedPC() && deref)
-                    dereferenceEmbedDependent(_broker.getStateManagerImpl(objval, false));
+                if (fmd.isEmbeddedPC() && deref) {
+                    StateManagerImpl sm = _broker.getStateManagerImpl(objval, false);
+                    if (sm != null) 
+                        dereferenceEmbedDependent(sm);
+                }
                 delete(fmd, objval, call);
             }
             else if (fmd.getCascadeDelete() == ValueMetaData.CASCADE_AUTO)



Mime
View raw message