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 PersistenceBroker.java
Date Fri, 14 Mar 2003 18:31:17 GMT
arminw      2003/03/14 10:31:16

  Modified:    src/java/org/apache/ojb/broker/singlevm
                        PersistenceBrokerImpl.java
               src/java/org/apache/ojb/broker PersistenceBroker.java
  Log:
  OJB142
  removeFromCache now handle Identities
  too
  
  Revision  Changes    Path
  1.141     +18 -10    db-ojb/src/java/org/apache/ojb/broker/singlevm/PersistenceBrokerImpl.java
  
  Index: PersistenceBrokerImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/singlevm/PersistenceBrokerImpl.java,v
  retrieving revision 1.140
  retrieving revision 1.141
  diff -u -r1.140 -r1.141
  --- PersistenceBrokerImpl.java	13 Mar 2003 17:22:41 -0000	1.140
  +++ PersistenceBrokerImpl.java	14 Mar 2003 18:31:14 -0000	1.141
  @@ -763,7 +763,7 @@
                   }
                   if (cds.isMtoNRelation())
                   {
  -                    currentMtoNKeys = getMtoNImplementor(cds, obj);                   

  +                    currentMtoNKeys = getMtoNImplementor(cds, obj);
                       // delete unused m:n implementors
                       deleteMtoNImplementor(cds, obj, (Collection)col, currentMtoNKeys);
                   }
  @@ -1052,7 +1052,7 @@
   //         logger.debug("Retrieving collection ["+cds.getCascadeRetrieve()
   //                      +"] MtoN ["+cds.isMtoNRelation()
   //                      +"] for "+obj.getClass().getName());
  -        
  +
           if (forced || cds.getCascadeRetrieve())
           {
               // this collection type will be used:
  @@ -1078,13 +1078,13 @@
                       fkQuery.getCriteria().addOrderBy((FieldHelper)iter.next());
                   }
               }
  -            
  -            // BRJ: customize the query 
  +
  +            // BRJ: customize the query
               if (cds.getQueryCustomizer() != null)
               {
                   fkQuery = cds.getQueryCustomizer().customizeQuery(obj,this, cds, fkQuery);
               }
  -            
  +
               if (collectionClass == null)
               {
                   Collection result = getCollectionByQuery(fkQuery, cds.isLazy());
  @@ -1206,8 +1206,8 @@
           }
   
           // ensure that top-level extents are used for Identities
  -        referencedClass = descriptorRepository.getTopLevelClass(rds.getItemClass());  
  
  -        
  +        referencedClass = descriptorRepository.getTopLevelClass(rds.getItemClass());
  +
           if (rds.isLazy())
           {
               referencedProxy = getClassDescriptor(referencedClass).getDynamicProxyClass();
  @@ -1771,7 +1771,7 @@
           // BRJ: if the first check fails, assign foreign keys and check again
   		if (!assertValidPkFields(cld.getPkFields(), pkValues))
   		{
  -            // BRJ: assign fk values, they may be part of pk        
  +            // BRJ: assign fk values, they may be part of pk
   			// 1. assign foreign key values so that they can be stored in step 2
   			assignReferenceFKs(obj, cld.getObjectReferenceDescriptors());
   
  @@ -2032,7 +2032,15 @@
       {
       	// objects must also be remove from LoadedObjectsRegistry
       	// Fix by Jamie Burns
  -        Identity identity = new Identity(obj, this);
  +        Identity identity;
  +        if (obj instanceof Identity)
  +        {
  +            identity = (Identity)obj;
  +        }
  +        else
  +        {
  +            identity = new Identity(obj, this);
  +        }
           Object objectToRemove = objectCache.lookup(identity);
           LoadedObjectsRegistry.remove(objectToRemove);
           objectCache.remove(identity);
  
  
  
  1.21      +6 -3      db-ojb/src/java/org/apache/ojb/broker/PersistenceBroker.java
  
  Index: PersistenceBroker.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/PersistenceBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- PersistenceBroker.java	9 Mar 2003 09:25:28 -0000	1.20
  +++ PersistenceBroker.java	14 Mar 2003 18:31:15 -0000	1.21
  @@ -311,8 +311,11 @@
       public void clearCache() throws PersistenceBrokerException;
   
       /**
  -     * Removes the objects obj from the brokers internal cache.
  -     * removing is not recursive.
  +     * Removes the object from the brokers internal cache.
  +     * If object is instance of {@link org.apache.ojb.broker.Identity},
  +     * the associated object was removed from cache.
  +     * <br/>
  +     * Removing is not recursive.
        */
       public void removeFromCache(Object obj) throws PersistenceBrokerException;
   
  
  
  

Mime
View raw message