db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f..@nexgo.de
Subject [PATCH] PersistenceBrokerImpl
Date Thu, 27 May 2004 17:09:12 GMT
Hi,

it's a tiny thing, but i'm wondering about a detail in the PersistenceBrokerImpl.

There are two  if (!doInsert){...}-Blocks.  
Thinking back to my boolean algebra lessons:  i'm shure the second block can't be reached,
when the first block isn't entered. 
So why you don't use the structure that i show in the attached patch?  Sould save one compare.
And make the workflow more clearer.
But maybe current version is just looking better...

regards,
Felix Braun



Index: PersistenceBrokerImpl.java
===================================================================
RCS file: /home/cvspublic/jakarta-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java,v
retrieving revision 1.80
diff -u -r1.80 PersistenceBrokerImpl.java
--- PersistenceBrokerImpl.java	7 May 2004 22:07:06 -0000	1.80
+++ PersistenceBrokerImpl.java	27 May 2004 16:22:29 -0000
@@ -686,17 +686,18 @@
             {
                 doInsert = deletedDuringTransaction.contains(oid);
                 shouldRemoveFromDeleted = true;
+                
+                /*
+                if PK values are set, lookup cache or db to see whether object
+                needs insert or update
+                */
+                if (!doInsert)
+                {
+                    doInsert = objectCache.lookup(oid) == null
+                        && !serviceBrokerHelper().doesExist(cld, oid, obj);
+                }
             }
-
-            /*
-            if PK values are set, lookup cache or db to see whether object
-            needs insert or update
-            */
-            if (!doInsert)
-            {
-                doInsert = objectCache.lookup(oid) == null
-                    && !serviceBrokerHelper().doesExist(cld, oid, obj);
-            }
+            
             // now store it:
             store(obj, oid, cld, doInsert);
 







Mime
View raw message