org.apache.lokahi.core.common.database
Class OracleBroker<T extends Dao>
java.lang.Object
org.apache.lokahi.core.common.interfaces.GenericDatabaseBroker<T>
org.apache.lokahi.core.common.database.OracleBroker<T>
- All Implemented Interfaces:
- ReadOnlyBroker<T>, TMCBroker<T>
public class OracleBroker<T extends Dao>
- extends GenericDatabaseBroker<T>
- implements TMCBroker<T>
- Version:
- $Id: OracleBroker.java,v 1.4 2006/03/07 20:18:52 drtobes Exp $
- Author:
- Stephen Toback
Method Summary |
void |
blobHack(java.lang.String lockStatement,
java.lang.String statement,
int id,
byte[] blobData)
|
protected java.sql.CallableStatement |
buildParams(java.sql.CallableStatement csmt,
boolean returns,
int returnType,
java.lang.Object... params)
Builds the parameter list for a CallableStatement object
based upon the parameters passed, currently supports only objects of
Integer , String , and byte[]
(for blobs) types. |
java.lang.String |
connectionReport()
|
boolean |
delete(java.lang.String statement,
java.lang.Object... params)
|
T |
getObject(java.lang.Class<T> c,
java.lang.String statement,
boolean cache,
java.lang.Object... params)
Gets a singular object from the datastore. |
java.util.Collection<T> |
getObjects(java.lang.Class<T> clazz,
boolean cache,
java.lang.String statement,
java.lang.Object... params)
Gets a collection of objects from the datastore. |
protected java.sql.CallableStatement |
getStatement(java.sql.Connection conn,
java.lang.String statement,
java.lang.Object[] params,
boolean isFunction)
|
protected java.sql.CallableStatement |
getStatement(java.sql.Connection conn,
java.lang.String statement,
java.lang.Object[] params,
boolean isFunction,
boolean returns,
int type)
|
void |
modifyRelationship(java.lang.String statement,
java.lang.Object... params)
|
int |
save(java.lang.String statement,
java.lang.Object... params)
|
void |
update(java.lang.String statement,
java.lang.Object... params)
|
void |
useSQL(java.lang.String statement,
java.lang.Object... params)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
connBean
public static final ConnBean connBean
getStatement
protected java.sql.CallableStatement getStatement(java.sql.Connection conn,
java.lang.String statement,
java.lang.Object[] params,
boolean isFunction)
throws java.sql.SQLException,
TMCIllegalArgumentException
- Throws:
java.sql.SQLException
TMCIllegalArgumentException
getStatement
protected java.sql.CallableStatement getStatement(java.sql.Connection conn,
java.lang.String statement,
java.lang.Object[] params,
boolean isFunction,
boolean returns,
int type)
throws java.sql.SQLException,
TMCIllegalArgumentException
- Throws:
java.sql.SQLException
TMCIllegalArgumentException
save
public int save(java.lang.String statement,
java.lang.Object... params)
throws java.sql.SQLException
- Specified by:
save
in interface TMCBroker<T extends Dao>
- Throws:
java.sql.SQLException
delete
public boolean delete(java.lang.String statement,
java.lang.Object... params)
throws java.sql.SQLException
- Specified by:
delete
in interface TMCBroker<T extends Dao>
- Throws:
java.sql.SQLException
update
public void update(java.lang.String statement,
java.lang.Object... params)
throws java.sql.SQLException
- Specified by:
update
in interface TMCBroker<T extends Dao>
- Throws:
java.sql.SQLException
modifyRelationship
public void modifyRelationship(java.lang.String statement,
java.lang.Object... params)
throws java.sql.SQLException
- Specified by:
modifyRelationship
in interface TMCBroker<T extends Dao>
- Throws:
java.sql.SQLException
useSQL
public void useSQL(java.lang.String statement,
java.lang.Object... params)
throws java.sql.SQLException
- Specified by:
useSQL
in interface TMCBroker<T extends Dao>
- Throws:
java.sql.SQLException
blobHack
public void blobHack(java.lang.String lockStatement,
java.lang.String statement,
int id,
byte[] blobData)
throws java.sql.SQLException
- Specified by:
blobHack
in interface TMCBroker<T extends Dao>
- Throws:
java.sql.SQLException
connectionReport
public java.lang.String connectionReport()
- Specified by:
connectionReport
in interface TMCBroker<T extends Dao>
getObject
public T getObject(java.lang.Class<T> c,
java.lang.String statement,
boolean cache,
java.lang.Object... params)
throws java.sql.SQLException
- Description copied from interface:
ReadOnlyBroker
- Gets a singular object from the datastore.
- Specified by:
getObject
in interface ReadOnlyBroker<T extends Dao>
- Parameters:
c
- Class
of the expected object return.statement
- key to get the object from the datastore.cache
- true
a cached object will suffice.params
- objects to look up the desired object by.
- Returns:
- object of
Class
c populated.
- Throws:
java.sql.SQLException
getObjects
public java.util.Collection<T> getObjects(java.lang.Class<T> clazz,
boolean cache,
java.lang.String statement,
java.lang.Object... params)
throws java.sql.SQLException
- Description copied from interface:
ReadOnlyBroker
- Gets a collection of objects from the datastore.
- Specified by:
getObjects
in interface ReadOnlyBroker<T extends Dao>
- Parameters:
clazz
- Class
of the expected object return.cache
- true
a cached object will suffice.statement
- key to get the object from the datastore.params
- objects to look up the desired object by.
- Returns:
- object of
Class
c populated.
- Throws:
java.sql.SQLException
buildParams
protected java.sql.CallableStatement buildParams(java.sql.CallableStatement csmt,
boolean returns,
int returnType,
java.lang.Object... params)
throws java.sql.SQLException
- Description copied from class:
GenericDatabaseBroker
- Builds the parameter list for a
CallableStatement
object
based upon the parameters passed, currently supports only objects of
Integer
, String
, and byte[]
(for blobs) types.
Prevents the need to explictitly code all CallableStatement
s
- Overrides:
buildParams
in class GenericDatabaseBroker<T extends Dao>
returns
- true
if the statement being built returns any valuereturnType
- as specified by the jdbc driverparams
- passed to the stored procedure or function
- Returns:
- built
CallableStatement
populated with the objects in params
- Throws:
java.sql.SQLException