org.hibernate.ejb.connection
Class InjectedDataSourceConnectionProvider

java.lang.Object
  extended by org.hibernate.connection.DatasourceConnectionProvider
      extended by org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
All Implemented Interfaces:
ConnectionProvider

public class InjectedDataSourceConnectionProvider
extends DatasourceConnectionProvider

A specialization of DatasourceConnectionProvider which uses the DataSource specified vi setDataSource(javax.sql.DataSource) rather than locating it from JNDI.

NOTE : setDataSource(javax.sql.DataSource) must be called prior to configure(java.util.Properties).

TODO : could not find where #setDataSource is actually called. Can't this just be passed in to #configure???

Author:
Emmanuel Bernard

Constructor Summary
InjectedDataSourceConnectionProvider()
           
 
Method Summary
 void configure(Properties props)
          Initialize the connection provider from given properties.
 Connection getConnection()
          Grab a connection, with the autocommit mode specified by hibernate.connection.autocommit.
 void setDataSource(DataSource ds)
           
 
Methods inherited from class org.hibernate.connection.DatasourceConnectionProvider
close, closeConnection, getDataSource, supportsAggressiveRelease
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InjectedDataSourceConnectionProvider

public InjectedDataSourceConnectionProvider()
Method Detail

setDataSource

public void setDataSource(DataSource ds)
Overrides:
setDataSource in class DatasourceConnectionProvider

configure

public void configure(Properties props)
               throws HibernateException
Description copied from interface: ConnectionProvider
Initialize the connection provider from given properties.

Specified by:
configure in interface ConnectionProvider
Overrides:
configure in class DatasourceConnectionProvider
Parameters:
props - SessionFactory properties
Throws:
HibernateException

getConnection

public Connection getConnection()
                         throws SQLException
Description copied from interface: ConnectionProvider
Grab a connection, with the autocommit mode specified by hibernate.connection.autocommit.

Specified by:
getConnection in interface ConnectionProvider
Overrides:
getConnection in class DatasourceConnectionProvider
Returns:
a JDBC connection
Throws:
SQLException


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.