edu.northwestern.at.utils.db.hibernate
Class SimpleHibernateConnectionProvider

java.lang.Object
  extended by edu.northwestern.at.utils.db.hibernate.SimpleHibernateConnectionProvider
All Implemented Interfaces:
org.hibernate.connection.ConnectionProvider

public class SimpleHibernateConnectionProvider
extends java.lang.Object
implements org.hibernate.connection.ConnectionProvider

A simple Hibernate connection provider.

This class wraps a SimpleConnectionPool.

Hibernate configuration properties are used to configure the SimpleConnectionPool properties as follows:

The remaining SimpleConnectionPool properties use their default values:


Constructor Summary
SimpleHibernateConnectionProvider()
           
 
Method Summary
 void addObserver(java.util.Observer o)
          Adds an observer.
 void close()
          Closes down the connection provider.
 void closeConnection(java.sql.Connection connection)
          Releases a connection back to the pool.
 void configure(java.util.Properties properties)
          Configures the connection provider.
 java.sql.Connection getConnection()
          Gets a connection from the pool.
 boolean supportsAggressiveRelease()
          Indicates if aggressive release is supported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleHibernateConnectionProvider

public SimpleHibernateConnectionProvider()
Method Detail

configure

public void configure(java.util.Properties properties)
               throws org.hibernate.HibernateException
Configures the connection provider.

Specified by:
configure in interface org.hibernate.connection.ConnectionProvider
Parameters:
properties - The Hibernate configuration properties.
Throws:
org.hibernate.HibernateException

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Gets a connection from the pool.

Specified by:
getConnection in interface org.hibernate.connection.ConnectionProvider
Returns:
A connection.
Throws:
java.sql.SQLException

closeConnection

public void closeConnection(java.sql.Connection connection)
                     throws java.sql.SQLException
Releases a connection back to the pool.

Specified by:
closeConnection in interface org.hibernate.connection.ConnectionProvider
Parameters:
connection - The connection to return to the pool.
Throws:
java.sql.SQLException

close

public void close()
Closes down the connection provider.

Specified by:
close in interface org.hibernate.connection.ConnectionProvider

supportsAggressiveRelease

public boolean supportsAggressiveRelease()
Indicates if aggressive release is supported.

Specified by:
supportsAggressiveRelease in interface org.hibernate.connection.ConnectionProvider
Returns:
false (aggressive release is not supported).

addObserver

public void addObserver(java.util.Observer o)
Adds an observer.

The observer is notified whenever a bad JDBC connection is detected and whenever it takes more than one attempt to obtain a new connection. See SimpleConnectionPool for more details.

Parameters:
o - Observer.