Package org.openbravo.service.db
Class DalConnectionProvider
- java.lang.Object
-
- org.openbravo.service.db.DalConnectionProvider
-
- All Implemented Interfaces:
ConnectionProvider
public class DalConnectionProvider extends Object implements ConnectionProvider
A connection provider which is created on the basis of the current connection of the DAL (seeOBDal.getConnection()
). It read the properties through theOBPropertiesProvider
. Note: this implementation- does not support connection pooling
- does not close the connection
- it flushes the hibernate session before returning a connection by default, but this can be
overriden by using the constructor with the flush parameter (
OBDal.flush()
)
DalConnectionProvider
is not thread safe, the same instance should never be accessed by two different threads.- Author:
- mtaal
-
-
Constructor Summary
Constructors Constructor Description DalConnectionProvider()
DalConnectionProvider(boolean flush)
-
Method Summary
-
-
-
Method Detail
-
destroy
public void destroy() throws Exception
- Specified by:
destroy
in interfaceConnectionProvider
- Throws:
Exception
-
getReadOnlyConnectionProvider
public static DalConnectionProvider getReadOnlyConnectionProvider()
-
getConnection
public Connection getConnection() throws NoConnectionAvailableException
- Specified by:
getConnection
in interfaceConnectionProvider
- Throws:
NoConnectionAvailableException
-
setConnection
public void setConnection(Connection connection)
-
getRDBMS
public String getRDBMS()
- Specified by:
getRDBMS
in interfaceConnectionProvider
-
getTransactionConnection
public Connection getTransactionConnection() throws NoConnectionAvailableException, SQLException
- Specified by:
getTransactionConnection
in interfaceConnectionProvider
- Throws:
NoConnectionAvailableException
SQLException
-
releaseCommitConnection
public void releaseCommitConnection(Connection conn) throws SQLException
- Specified by:
releaseCommitConnection
in interfaceConnectionProvider
- Throws:
SQLException
-
releaseRollbackConnection
public void releaseRollbackConnection(Connection conn) throws SQLException
- Specified by:
releaseRollbackConnection
in interfaceConnectionProvider
- Throws:
SQLException
-
getPreparedStatement
public PreparedStatement getPreparedStatement(String SQLPreparedStatement) throws Exception
- Specified by:
getPreparedStatement
in interfaceConnectionProvider
- Throws:
Exception
-
getPreparedStatement
public PreparedStatement getPreparedStatement(String poolName, String SQLPreparedStatement) throws Exception
- Specified by:
getPreparedStatement
in interfaceConnectionProvider
- Throws:
Exception
-
getPreparedStatement
public PreparedStatement getPreparedStatement(Connection conn, String SQLPreparedStatement) throws SQLException
- Specified by:
getPreparedStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
getCallableStatement
public CallableStatement getCallableStatement(String SQLCallableStatement) throws Exception
- Specified by:
getCallableStatement
in interfaceConnectionProvider
- Throws:
Exception
-
getCallableStatement
public CallableStatement getCallableStatement(String poolName, String SQLCallableStatement) throws Exception
- Specified by:
getCallableStatement
in interfaceConnectionProvider
- Throws:
Exception
-
getCallableStatement
public CallableStatement getCallableStatement(Connection conn, String SQLCallableStatement) throws SQLException
- Specified by:
getCallableStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
getStatement
public Statement getStatement() throws Exception
- Specified by:
getStatement
in interfaceConnectionProvider
- Throws:
Exception
-
getStatement
public Statement getStatement(String poolName) throws Exception
- Specified by:
getStatement
in interfaceConnectionProvider
- Throws:
Exception
-
getStatement
public Statement getStatement(Connection conn) throws SQLException
- Specified by:
getStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
releasePreparedStatement
public void releasePreparedStatement(PreparedStatement preparedStatement) throws SQLException
- Specified by:
releasePreparedStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
releaseCallableStatement
public void releaseCallableStatement(CallableStatement callableStatement) throws SQLException
- Specified by:
releaseCallableStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
releaseStatement
public void releaseStatement(Statement statement) throws SQLException
- Specified by:
releaseStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
releaseTransactionalStatement
public void releaseTransactionalStatement(Statement statement) throws SQLException
- Specified by:
releaseTransactionalStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
releaseTransactionalPreparedStatement
public void releaseTransactionalPreparedStatement(PreparedStatement preparedStatement) throws SQLException
- Specified by:
releaseTransactionalPreparedStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
getStatus
public String getStatus()
- Specified by:
getStatus
in interfaceConnectionProvider
-
getProperties
public Properties getProperties()
-
setProperties
public void setProperties(Properties properties)
-
-