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/core PersistenceBrokerImpl.java
Date Thu, 07 Oct 2004 16:57:39 GMT
arminw      2004/10/07 09:57:39

  Modified:    src/java/org/apache/ojb/broker/core Tag: OJB_1_0_RELEASE
                        PersistenceBrokerImpl.java
  Log:
  only store none or materialzed proxy objects, unmaterialized proxy objects don't need update
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.83.2.7  +12 -5     db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
  
  Index: PersistenceBrokerImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java,v
  retrieving revision 1.83.2.6
  retrieving revision 1.83.2.7
  diff -u -r1.83.2.6 -r1.83.2.7
  --- PersistenceBrokerImpl.java	4 Oct 2004 13:19:49 -0000	1.83.2.6
  +++ PersistenceBrokerImpl.java	7 Oct 2004 16:57:38 -0000	1.83.2.7
  @@ -48,9 +48,9 @@
   import org.apache.ojb.broker.cache.InternalCache;
   import org.apache.ojb.broker.cache.ObjectCache;
   import org.apache.ojb.broker.cache.ObjectCacheFactory;
  +import org.apache.ojb.broker.core.proxy.CollectionProxy;
   import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
   import org.apache.ojb.broker.core.proxy.ProxyHelper;
  -import org.apache.ojb.broker.core.proxy.CollectionProxy;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException;
   import org.apache.ojb.broker.metadata.CollectionDescriptor;
  @@ -1510,14 +1510,21 @@
        * E.G. by INSERT INTO ... or UPDATE ...  in an RDBMS.
        * The ObjectModification parameter can be used to determine whether INSERT or update
is to be used.
        * This functionality is typically called from transaction managers, that
  -     * track which objects have to be stored.
  +     * track which objects have to be stored. If the object is an unmaterialized
  +     * proxy the method return immediately.
        */
       public void store(Object obj, ObjectModification mod) throws PersistenceBrokerException
       {
  -        obj = ProxyHelper.getRealObject(obj);
  +        obj = ProxyHelper.getRealObjectIfMaterialized(obj);
  +        if (obj == null)    // null for unmaterialized Proxy
  +        {
  +            if(logger.isDebugEnabled())
  +                logger.debug("No materialized object could be found -> nothing to store");
  +            return;
  +        }
           ClassDescriptor cld = getClassDescriptor(obj.getClass());
           // this call ensures that all autoincremented primary key attributes are filled
  -        Identity oid = new Identity(obj, this, cld);
  +        Identity oid = serviceIdentity().buildIdentity(cld, obj);
           // select flag for insert / update selection by checking the ObjectModification
           if (mod.needsInsert())
           {
  
  
  

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