db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/util/sequence SequenceManagerMySQLImpl.java
Date Fri, 14 Feb 2003 20:54:32 GMT
thma        2003/02/14 12:54:32

  Modified:    src/java/org/apache/ojb/broker/util/sequence
                        SequenceManagerMySQLImpl.java
  Log:
  fix proxy problem
  
  Revision  Changes    Path
  1.8       +5 -15     db-ojb/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerMySQLImpl.java
  
  Index: SequenceManagerMySQLImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerMySQLImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SequenceManagerMySQLImpl.java	5 Feb 2003 20:16:00 -0000	1.7
  +++ SequenceManagerMySQLImpl.java	14 Feb 2003 20:54:32 -0000	1.8
  @@ -17,6 +17,7 @@
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.util.ProxyHelper;
   import org.apache.ojb.broker.accesslayer.JdbcAccess;
   import org.apache.ojb.broker.accesslayer.ResultSetAndStatement;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
  @@ -168,23 +169,13 @@
        */
       private void assertFkAssignment(Object obj, ClassDescriptor cld, Object ref, ObjectReferenceDescriptor
rds)
       {
  -        /**
  -         Not sure if this is needed?
  -
  -         if ((!(obj instanceof VirtualProxy))
  -         && (!(obj instanceof Proxy))
  -         && (ref != null)
  -         && (!(ref instanceof VirtualProxy))
  -         && (!(ref instanceof Proxy)))
  -         {*/
  +    	// avoid problems with proxy instances
  +        Class c = ProxyHelper.getRealClass(ref);
   
           // get ClassDescriptor for RefDescriptor object
           ClassDescriptor refCld =
  -                broker.getDescriptorRepository().getDescriptorFor(ref.getClass());
  -        // since there can only be 1 auto_inc column, we don't need to get the whole set
of pkvalues
  -        //Object[] refPkValues = refCld.getKeyValues(ref);
  +                broker.getDescriptorRepository().getDescriptorFor(c);
           ClassDescriptor objCld = cld;
  -        // waste - broker.getDescriptorRepository().getDescriptorFor(obj.getClass());
   
           // get all the fielddescriptors in the objects that reference this one so we can
set the new id
           FieldDescriptor[] objFkFields =
  @@ -199,7 +190,6 @@
                   fld.getPersistentField().set(obj, refFld.getPersistentField().get(ref));
               }
           }
  -        //}
       }
   
   
  
  
  

Mime
View raw message