db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r518401 - in /db/ojb/trunk/src/java/org/apache/ojb/broker: accesslayer/JdbcAccessImpl.java core/IdentityFactoryImpl.java util/BrokerHelper.java
Date Thu, 15 Mar 2007 00:55:25 GMT
Author: arminw
Date: Wed Mar 14 17:55:24 2007
New Revision: 518401

URL: http://svn.apache.org/viewvc?view=rev&rev=518401
Log:
use new convenience method to check for 'null' fields

Modified:
    db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/JdbcAccessImpl.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/core/IdentityFactoryImpl.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/util/BrokerHelper.java

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/JdbcAccessImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/JdbcAccessImpl.java?view=diff&rev=518401&r1=518400&r2=518401
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/JdbcAccessImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/JdbcAccessImpl.java Wed Mar 14
17:55:24 2007
@@ -248,8 +248,6 @@
         {
             values = extractValues(cld.getAllRwFields(), obj);
         }
-        // if DB Identity columns are used for PK values, we can't use batch
-        // updates for object insert
         if(isInBatchMode(cld) && !isStoredProcedure)
         {
             Batcher batcher = new Batcher.Insert(cld, cld.getInsertProcedure(), sql);
@@ -1202,8 +1200,7 @@
             field = fields[i];
             if(field.isAutoIncrement() && !field.isAccessReadOnly())
             {
-                Object value = field.getPersistentField().get(target);
-                if(broker.serviceBrokerHelper().representsNull(field, value))
+                if(field.representsNullAssociatedValue(target))
                 {
                     Object id = broker.serviceSequenceManager().getUniqueValue(broker, field);
                     field.getPersistentField().set(target, id);

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/core/IdentityFactoryImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/core/IdentityFactoryImpl.java?view=diff&rev=518401&r1=518400&r2=518401
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/core/IdentityFactoryImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/core/IdentityFactoryImpl.java Wed Mar 14 17:55:24
2007
@@ -112,7 +112,7 @@
                     we check all PK fields for 'null'-values
                     */
                     Object value = fld.getPersistentField().get(objOrProxy);
-                    if(helper.representsNull(fld, value))
+                    if(fld.representsNull(value))
                     {
                         result = (Identity) transientIdentityMap.get(objOrProxy);
                         if(result == null)

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/util/BrokerHelper.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/util/BrokerHelper.java?view=diff&rev=518401&r1=518400&r2=518401
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/util/BrokerHelper.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/util/BrokerHelper.java Wed Mar 14 17:55:24
2007
@@ -299,14 +299,6 @@
     }
 
     /**
-     * Decide if the given object value represents 'null'.
-     */
-    public boolean representsNull(FieldDescriptor fld, Object aValue)
-    {
-    	return fld.getNullCheck().representsNull(fld, aValue);
-    }
-
-    /**
      * Detect if the given object has a PK field represents a 'null' value.
      */
     public boolean hasNullPKField(ClassDescriptor cld, Object obj)
@@ -322,7 +314,7 @@
             for(int i = 0; i < fields.length; i++)
             {
                 fld = fields[i];
-                hasNull = representsNull(fld, fld.getPersistentField().get(obj));
+                hasNull = fld.representsNullAssociatedValue(obj);
                 if(hasNull) break;
             }
         }
@@ -356,7 +348,7 @@
                 sql type so that the entire result array contains
                 objects that are properly typed for sql.
                 */
-                if(representsNull(fld, fld.getPersistentField().get(target))) assignAutoIncrement(fld,
target);
+                if(fld.representsNullAssociatedValue(target)) assignAutoIncrement(fld, target);
             }
             else
             {
@@ -500,7 +492,7 @@
              */
             if(!(fld.isAutoIncrement()
                     || fld.isLocking()
-                    || !representsNull(fld, pkValues[i])))
+                    || !fld.representsNull(pkValues[i])))
             {
                 return false;
             }
@@ -523,9 +515,7 @@
             int fieldDescriptorSize = fieldDescriptors.length;
             for(int i = 0; i < fieldDescriptorSize; i++)
             {
-                FieldDescriptor fd = fieldDescriptors[i];
-                Object pkValue = fd.getPersistentField().get(obj);
-                if (representsNull(fd, pkValue))
+                if (fieldDescriptors[i].representsNullAssociatedValue(obj))
                 {
                     return false;
                 }



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message