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/metadata ObjectReferenceDescriptor.java
Date Sun, 03 Apr 2005 02:20:43 GMT
arminw      2005/04/02 18:20:43

  Modified:    src/java/org/apache/ojb/broker/metadata Tag: OJB_1_0_RELEASE
                        ObjectReferenceDescriptor.java
  Log:
  add check for proxy object, materialize object when needed
  add method comment
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.37.2.1  +7 -0      db-ojb/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java
  
  Index: ObjectReferenceDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java,v
  retrieving revision 1.37
  retrieving revision 1.37.2.1
  diff -u -r1.37 -r1.37.2.1
  --- ObjectReferenceDescriptor.java	13 Jun 2004 08:26:01 -0000	1.37
  +++ ObjectReferenceDescriptor.java	3 Apr 2005 02:20:43 -0000	1.37.2.1
  @@ -22,6 +22,7 @@
   import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.ojb.broker.OJBRuntimeException;
   import org.apache.ojb.broker.PersistenceBrokerException;
  +import org.apache.ojb.broker.core.proxy.ProxyHelper;
   import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
   
   /**
  @@ -142,12 +143,18 @@
   	}
   
       /**
  +     * Returns an Object array of all FK field values of the specified object.
  +     * If the specified object is an unmaterialized Proxy, it will be materialized
  +     * to read the FK values.
  +     *
        * @throws MetadataException if an error occours while accessing ForeingKey values
on obj
        */
       public Object[] getForeignKeyValues(Object obj, ClassDescriptor mif)
               throws PersistenceBrokerException
       {
           FieldDescriptor[] fks = getForeignKeyFieldDescriptors(mif);
  +        // materialize object only if FK fields are declared
  +        if(fks.length > 0) obj = ProxyHelper.getRealObject(obj);
           Object[] result = new Object[fks.length];
           for (int i = 0; i < result.length; i++)
           {
  
  
  

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