db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/util BrokerHelper.java
Date Sun, 03 Apr 2005 02:14:45 GMT
arminw      2005/04/02 18:14:45

  Modified:    src/java/org/apache/ojb/broker/util Tag: OJB_1_0_RELEASE
                        BrokerHelper.java
  Log:
  take care of proxy objects
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.57.2.11 +13 -7     db-ojb/src/java/org/apache/ojb/broker/util/BrokerHelper.java
  
  Index: BrokerHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/BrokerHelper.java,v
  retrieving revision 1.57.2.10
  retrieving revision 1.57.2.11
  diff -u -r1.57.2.10 -r1.57.2.11
  --- BrokerHelper.java	19 Mar 2005 14:05:01 -0000	1.57.2.10
  +++ BrokerHelper.java	3 Apr 2005 02:14:45 -0000	1.57.2.11
  @@ -289,12 +289,18 @@
       {
           FieldDescriptor[] fields = cld.getPkFields();
           boolean hasNull = false;
  -        FieldDescriptor fld;
  -        for(int i = 0; i < fields.length; i++)
  -        {
  -            fld = fields[i];
  -            hasNull = representsNull(fld, fld.getPersistentField().get(obj));
  -            if(hasNull) break;
  +        // an unmaterialized proxy object can never have nullified PK's
  +        IndirectionHandler handler = ProxyHelper.getIndirectionHandler(obj);
  +        if(handler == null || handler.alreadyMaterialized())
  +        {
  +            if(handler != null) obj = handler.getRealSubject();
  +            FieldDescriptor fld;
  +            for(int i = 0; i < fields.length; i++)
  +            {
  +                fld = fields[i];
  +                hasNull = representsNull(fld, fld.getPersistentField().get(obj));
  +                if(hasNull) break;
  +            }
           }
           return hasNull;
       }
  
  
  

---------------------------------------------------------------------
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