db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Kalén <mka...@apache.org>
Subject Summary of changes for OJB-14, OJB-31
Date Tue, 26 Apr 2005 04:16:10 GMT
Greetings,
  to implement generic JDBC property support when creating Connection
instances via DriverManager (ie OJB-14 [1]), I made PoolConfiguration
an AttributeContainer and extended repository.dtd with custom attributes
for the connection-pool element belonging to the jdbc-connection-descriptor.

To separate "OJB-internal" custom attributes for connection-pool from
JDBC-driver attributes, I made the following distinction (comments in DTD +
docs updated with similar texts):
         All attributes with names starting with "jdbc." will be
         passed (without jdbc. prefix) to the JDBC DriverManager
         when creating new Connection objects.
         (Ignored when acquiring Connection objects through
          JNDI DataSource lookup or in managed environments.)


Our ConnectionFactory implementations create Connection instances from
DriverManager in three classes:
  ConnectionFactoryNotPooledImpl#checkOutJdbcConnection
  ConnectionFactoryPooledImpl/ConPoolFactory#makeObject
  ConnectionFactoryDBCPImpl/ConPoolFactory#createConnection

The first two will use:
  ConnectionFactoryAbstractImpl#newConnectionFromDriverManager
and the DBCP impl uses DBCP's own DriverManagerConnectionFactory code.

I have centralized the property handling to ConnectionFactoryAbstractImpl#getJdbcProperties,
so that it works in the same way even if DBCP and non-DBCP factories use it a bit differently.



The first workload of OJB-31 is also done, but I do not consider this to be ready
and I want feedback + reviews.

The fetchSize hint is now controlled on two levels:
  1) connection-pool default by setting:
    <attribute attribute-name="fetchSize" attribute-value="0"/>
    to a value>0

  2) on the Query level, with OJB-internal programmatic calls to:
    Query#setFetchSize(1) for all Iterator/Enumeration in PersistenceBrokerImpl

StatementsForClassImpl will look at these values if the FORCEJDBC1_0
flag is not set. See the internal helper function #afterJdbc2CapableStatementCreate.

Algorithm is as follows:
     if (explicitFetchSizeHint == StatementManagerIF.FETCH_SIZE_NOT_APPLICABLE)
     {
       fetchSizeHint = StatementManagerIF.FETCH_SIZE_NOT_APPLICABLE;
     }
     else if (explicitFetchSizeHint != StatementManagerIF.FETCH_SIZE_NOT_EXPLICITLY_SET)
     {
       fetchSizeHint = explicitFetchSizeHint; // specific for this Statement
     }
     else
     {
       fetchSizeHint = this.fetchSize; // connection pool default
     }

The "explicitFetchSizeHint" comes mostly from the Query.



When implementing fetchSize hints, I felt that I did not know the design well enough
to make optimal changes in Query vs StatementsForClassIF vs StatementManagerIF.

I would appreciate if at least Jakob could review this, since I am sure some things
should be moved around a bit (feel free to refactor at will, I am not making any
new changes before getting feedback on the list).

One thing that got particularily difficult was where to place constant values for
FETCH_SIZE_NOT_APPLICABLE and FETCH_SIZE_NOT_EXPLICITLY_SET, a distinction that
StatementForClassImpl needs to know.

I could not really tell if these values belonged to StatementsForClassIF or
StatementManagerIF. (And when it's difficult to decide it is usually an indication
that *both* are the wrong place.) ;-)

Regards,
  Martin

P.S. Both features are only on the OJB_1_0_RELEASE branch yet!
No changes should break any "external" OJB API between 1.0.3 and 1.0.4
(at least that is my intention!) and the fetchSize hint is disabled
in the default configuration.

[1] http://issues.apache.org/jira/browse/OJB-14
[2] http://issues.apache.org/jira/browse/OJB-31

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