org.hibernate.connection
Class ConnectionProviderFactory

java.lang.Object
  extended by org.hibernate.connection.ConnectionProviderFactory

public final class ConnectionProviderFactory
extends Object

Instantiates a connection provider given either System properties or a java.util.Properties instance. The ConnectionProviderFactory first attempts to find a name of a ConnectionProvider subclass in the property hibernate.connection.provider_class. If missing, heuristics are used to choose either DriverManagerConnectionProvider, DatasourceConnectionProvider, C3P0ConnectionProvider or DBCPConnectionProvider.

Author:
Gavin King
See Also:
ConnectionProvider

Method Summary
static Properties getConnectionProperties(Properties properties)
          Transform JDBC connection properties.
static ConnectionProvider newConnectionProvider()
          Instantiate a ConnectionProvider using System properties.
static ConnectionProvider newConnectionProvider(Properties properties)
          Instantiate a ConnectionProvider using given properties.
static ConnectionProvider newConnectionProvider(Properties properties, Map connectionProviderInjectionData)
          Create a connection provider based on the given information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newConnectionProvider

public static ConnectionProvider newConnectionProvider()
                                                throws HibernateException
Instantiate a ConnectionProvider using System properties.

Returns:
The created connection provider.
Throws:
HibernateException

newConnectionProvider

public static ConnectionProvider newConnectionProvider(Properties properties)
                                                throws HibernateException
Instantiate a ConnectionProvider using given properties. Method newConnectionProvider.

Parameters:
properties - hibernate SessionFactory properties
Returns:
ConnectionProvider
Throws:
HibernateException

newConnectionProvider

public static ConnectionProvider newConnectionProvider(Properties properties,
                                                       Map connectionProviderInjectionData)
                                                throws HibernateException
Create a connection provider based on the given information.

Parameters:
properties - Properties being used to build the SessionFactory.
connectionProviderInjectionData - Something to be injected in the connection provided
Returns:
The created connection provider
Throws:
HibernateException

getConnectionProperties

public static Properties getConnectionProperties(Properties properties)
Transform JDBC connection properties. Passed in the form hibernate.connection.* to the format accepted by DriverManager by trimming the leading "hibernate.connection".



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