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 Sat, 13 Dec 2003 18:58:11 GMT
arminw      2003/12/13 10:58:11

  Modified:    src/java/org/apache/ojb/broker/core
                        PersistenceBrokerImpl.java
  Log:
  to release used DB resources instandly better
  use OJBIterator instead Iterator
  
  fix javadoc
  
  Revision  Changes    Path
  1.60      +17 -12    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.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- PersistenceBrokerImpl.java	13 Dec 2003 18:10:13 -0000	1.59
  +++ PersistenceBrokerImpl.java	13 Dec 2003 18:58:11 -0000	1.60
  @@ -405,7 +405,7 @@
       }
   
       /**
  -     * @see PersistenceBroker#delete
  +     * @see org.apache.ojb.broker.PersistenceBroker#delete
        */
       public void delete(Object obj) throws PersistenceBrokerException
       {
  @@ -1208,15 +1208,20 @@
           }
           else
           {
  -            Iterator it = getIteratorByQuery(query);
  -            if (!it.hasNext())
  -            {
  -                return null;
  -            }
  -            else
  +            Class itemClass = query.getSearchClass();
  +            ClassDescriptor cld = getClassDescriptor(itemClass);
  +            /*
  +            use OJB intern Iterator, thus we are able to close used
  +            resources instantly
  +            */
  +            OJBIterator it = getIteratorFromQuery(query, cld);
  +            Object result = null;
  +            if (it.hasNext())
               {
  -                return it.next();
  +                result = it.next();
               }
  +            it.releaseDbResources();
  +            return result;
           }
       }
   
  @@ -1461,7 +1466,7 @@
       }
   
       /**
  -     * @see PersistenceBroker#removeFromCache
  +     * @see org.apache.ojb.broker.PersistenceBroker#removeFromCache
        */
       public void removeFromCache(Object obj) throws PersistenceBrokerException
       {
  @@ -1514,7 +1519,7 @@
       }
   
       /**
  -     * @see PersistenceBroker#getTopLevelClass
  +     * @see org.apache.ojb.broker.PersistenceBroker#getTopLevelClass
        */
       public Class getTopLevelClass(Class clazz) throws PersistenceBrokerException
       {
  @@ -1529,7 +1534,7 @@
       }
   
       /**
  -     * @see PersistenceBroker#getCount(Query)
  +     * @see org.apache.ojb.broker.PersistenceBroker#getCount(Query)
        */
       public int getCount(Query query) throws PersistenceBrokerException
       {
  
  
  

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