db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From olegn...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/singlevm PersistenceBrokerImpl.java
Date Sun, 16 Mar 2003 18:10:23 GMT
olegnitz    2003/03/16 10:10:23

  Modified:    src/java/org/apache/ojb/broker/singlevm
                        PersistenceBrokerImpl.java
  Log:
  The 'nowStoring' list of objects which is used to avoid infinite recursion
  is filled also when 'store(Object obj, ObjectModification mod)' is called.
  
  Revision  Changes    Path
  1.145     +20 -20    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.144
  retrieving revision 1.145
  diff -u -r1.144 -r1.145
  --- PersistenceBrokerImpl.java	16 Mar 2003 10:03:08 -0000	1.144
  +++ PersistenceBrokerImpl.java	16 Mar 2003 18:10:22 -0000	1.145
  @@ -623,26 +623,18 @@
                   return;
               }
   
  -            nowStoring.add(obj);
  -            try
  -            {
  -                ClassDescriptor cld = descriptorRepository.getDescriptorFor(obj.getClass());
  -                Identity oid = new Identity(obj, this, cld);
  -                // check if update or insert is needed
  -                boolean doInsert = false;
  -                // lookup cache or db to see whether object needs insert or update
  -                if (objectCache.lookup(oid) == null
  -                        && dbAccess.materializeObject(cld, oid) == null)
  -                {
  -                    doInsert = true;
  -                    // now store it:
  -                }
  -                store(obj, oid, cld, doInsert);
  -            }
  -            finally
  +            ClassDescriptor cld = descriptorRepository.getDescriptorFor(obj.getClass());
  +            Identity oid = new Identity(obj, this, cld);
  +            // check if update or insert is needed
  +            boolean doInsert = false;
  +            // lookup cache or db to see whether object needs insert or update
  +            if (objectCache.lookup(oid) == null
  +                    && dbAccess.materializeObject(cld, oid) == null)
               {
  -                nowStoring.remove(obj);
  +                doInsert = true;
  +                // now store it:
               }
  +            store(obj, oid, cld, doInsert);
           }
           // if Object == null do nothing
           else
  @@ -1735,7 +1727,15 @@
   
           if (obj != null)
           {
  -            storeToDb(obj, cld, oid, insert);
  +            nowStoring.add(obj);
  +            try
  +            {
  +                storeToDb(obj, cld, oid, insert);
  +            }
  +            finally
  +            {
  +                nowStoring.remove(obj);
  +            }
           }
           else
           {
  
  
  

Mime
View raw message