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/accesslayer PkEnumeration.java
Date Tue, 08 Jul 2003 00:33:03 GMT
arminw      2003/07/07 17:33:03

  Modified:    src/java/org/apache/ojb/broker/accesslayer
                        PkEnumeration.java
  Log:
  fix, don't use default PB
  
  Revision  Changes    Path
  1.11      +7 -12     db-ojb/src/java/org/apache/ojb/broker/accesslayer/PkEnumeration.java
  
  Index: PkEnumeration.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/PkEnumeration.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PkEnumeration.java	16 Mar 2003 12:04:32 -0000	1.10
  +++ PkEnumeration.java	8 Jul 2003 00:33:03 -0000	1.11
  @@ -85,6 +85,8 @@
       protected boolean hasCalledCheck = false;
       protected boolean hasNext = false;
   
  +    protected PersistenceBroker broker;
  +
       /**
        * The underlying jdbc resultset produced by select statement
        */
  @@ -101,11 +103,6 @@
       protected Constructor constructor;
   
       /**
  -     * the statement manager, we hold on to so we can close resources later.
  -     */
  -    private StatementManagerIF m_statementManager;
  -
  -    /**
        * PkEnumeration constructor.
        * @param query the SELECT statement gerating the underlying resultset
        * @param cld classDescriptor of the target entity class (say Article)
  @@ -116,7 +113,7 @@
       {
           this.resultSetAndStatment = broker.serviceJdbcAccess().executeQuery(query, cld);
           this.classDescriptor = cld;
  -        this.m_statementManager = broker.serviceStatementManager();
  +        this.broker = broker;
           // get a contructor object that can be used to build instances of class primaryKeyClass
           try
           {
  @@ -147,7 +144,7 @@
               // 1. get an empty instance of the target class
               Constructor con = classDescriptor.getZeroArgumentConstructor();
               Object obj = ConstructorHelper.instantiate(con);
  -            
  +
               // 2. fill only primary key values from Resultset
               Object colValue;
               FieldDescriptor fld;
  @@ -159,9 +156,7 @@
                   fld.getPersistentField().set(obj, colValue);
               }
               // 3. return the representing identity object
  -            PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
  -            Identity result = new Identity(obj, broker);
  -            broker.close();
  +            Identity result = new Identity(obj, broker, classDescriptor);
               return result;
           }
           catch (SQLException e)
  @@ -205,7 +200,7 @@
   
       private void releaseDbResources()
       {
  -        m_statementManager.closeResources(resultSetAndStatment.m_stmt, resultSetAndStatment.m_rs);
  +        broker.serviceStatementManager().closeResources(resultSetAndStatment.m_stmt, resultSetAndStatment.m_rs);
       }
   
       /**
  
  
  

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