You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Martin Kalén <mk...@apache.org> on 2005/04/26 06:16:10 UTC

Summary of changes for OJB-14, OJB-31

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


Re: Summary of changes for OJB-14, OJB-31

Posted by Martin Kalén <mk...@apache.org>.
Martin Kalén wrote:
> 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.

By the way, since we were recently discussing no new features in 1.0.x,
I did both these changes for 1.0.4 since it was hard to solve them
individually - the Properties feature affects the way fetchSize hints
are beeing used very much.

I hope that, since the user-visible changes are minor to nil, no one
objects.

Regards,
  Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org