org.springframework.orm.ojb.support
Class LocalDataSourceConnectionFactory

java.lang.Object
  extended byorg.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl
      extended byorg.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl
          extended byorg.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl
              extended byorg.springframework.orm.ojb.support.LocalDataSourceConnectionFactory
All Implemented Interfaces:
org.apache.ojb.broker.accesslayer.ConnectionFactory

public class LocalDataSourceConnectionFactory
extends org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl

OJB connection factory that delegates to Spring-managed DataSource beans.

Define the following entry in your OJB.properties to use this connection factory:

 ConnectionFactoryClass=org.springframework.orm.ojb.support.LocalDataSourceConnectionFactory
Interprets JCD aliases in OJB's JDBC connection descriptors as Spring bean names. For example, the following will delegate to the Spring bean named "myDataSource":
 <jdbc-connection-descriptor jcd-alias="myDataSource" default-connection="true" useAutoCommit="1"/>
Depends on LocalOjbConfigurer being defined as Spring bean, which will expose the Spring BeanFactory to the corresponding static field of this connection factory.

Since:
03.07.2004
Author:
Juergen Hoeller
See Also:
LocalOjbConfigurer

Field Summary
protected static BeanFactory beanFactory
          This will hold the BeanFactory to retrieve DataSource beans from.
 
Constructor Summary
LocalDataSourceConnectionFactory()
           
 
Method Summary
 Connection lookupConnection(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor jcd)
           
 
Methods inherited from class org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl
newConnectionFromDriverManager
 
Methods inherited from class org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl
getConnectionFromPool, returnConnectionToPool
 
Methods inherited from class org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl
getDbURL, initializeJdbcConnection, newConnectionFromDataSource, releaseAllResources, releaseConnection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

beanFactory

protected static BeanFactory beanFactory
This will hold the BeanFactory to retrieve DataSource beans from.

Constructor Detail

LocalDataSourceConnectionFactory

public LocalDataSourceConnectionFactory()
Method Detail

lookupConnection

public Connection lookupConnection(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor jcd)
                            throws org.apache.ojb.broker.accesslayer.LookupException
Throws:
org.apache.ojb.broker.accesslayer.LookupException


Copyright (C) 2003-2004 The Spring Framework Project.