|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectinfo.fingo.db.DatabaseOperations
public abstract class DatabaseOperations
Abstract class for different database operations
| Field Summary | |
|---|---|
protected java.lang.String |
MSSQL_SUFFIX
|
protected java.lang.String |
ORACLE_SUFFIX
|
| Constructor Summary | |
|---|---|
DatabaseOperations()
|
|
| Method Summary | |
|---|---|
protected abstract void |
bindInputParameter(java.sql.PreparedStatement ps,
int type,
int index,
java.lang.Object value)
Binds a single parameter to its value in the given PreparedStatement |
protected abstract void |
bindParameters(BaseCollection peer,
BaseEntity entity,
java.util.ArrayList<java.lang.String> names,
java.sql.PreparedStatement ps,
int initialIndex)
Binds parameters for the given PreparedStatement objects |
abstract void |
bindResourceCallParams(java.sql.CallableStatement cs,
java.util.ArrayList<Parameter> params,
java.sql.Connection conn)
Binds parameters for a callable statement for a SQL statement taken from an external resource |
abstract void |
bindResourceParams(java.sql.PreparedStatement ps,
java.util.ArrayList<Parameter> params,
java.sql.Connection conn)
Binds parameters for a prepared statement for a SQL statement taken from an external resource |
protected void |
delete(BaseCollection peer,
BaseEntity where,
java.sql.Connection conn)
Performs the given SQL delete statement on the given collection represented by a BaseCollection object |
protected void |
deleteByPrimaryKey(BaseCollection collection,
java.lang.Object primaryKey,
java.sql.Connection conn)
Deletes the instance with the given primary key from the database |
void |
execute(java.lang.String query,
java.sql.Connection conn)
Executes the given SQL statement |
protected static Column |
getColumn(BaseCollection instance,
java.lang.String columnName)
Retrieves Column-objects for the current table |
protected Column |
getColumnForName(Column[] cols,
java.lang.String name)
Retrieves a column with the given name from the given array of Column objects |
abstract void |
mapAndSetCallOutParam(java.sql.CallableStatement cs,
Parameter p)
Maps an OUT parameter for the given CallableStatement |
java.util.ArrayList<BaseEntity> |
mapQuery(java.sql.PreparedStatement ps,
BaseCollection peer,
java.sql.Connection conn)
Maps the given prepared statement to a list of BaseEntity objects |
java.util.ArrayList<BaseEntity[]> |
mapQuery(java.lang.String q,
BaseCollection[] peers,
java.sql.Connection conn)
Maps the given SQL query to a list of BaseEntity arrays |
java.util.ArrayList<BaseEntity> |
mapQuery(java.lang.String q,
BaseCollection peer,
java.sql.Connection conn)
Maps the given SQL query to a list of BaseEntity objects |
abstract BaseEntity |
mapResultSet(java.sql.ResultSet rs,
BaseCollection collection)
Maps the given result set to a BaseEntity object |
protected abstract int |
mapToSpecificTypeNumber(Column.GenericTypes genericType)
Maps the given generic data type to its JDBC numeric value |
abstract java.lang.Object |
save(BaseCollection peer,
BaseEntity bo,
java.sql.Connection conn)
Saves or updates the given BaseEntity object in the database |
protected java.util.ArrayList<BaseEntity> |
select(BaseCollection peer,
BaseEntity where,
java.sql.Connection conn)
Performs a select operation on the given BaseCollection object with the given where criteria |
protected java.util.ArrayList<BaseEntity> |
select(BaseCollection peer,
BaseEntity where,
java.lang.String orderBy,
java.sql.Connection conn)
Performs a select operation on the given BaseCollection object with the given where and orderBy-criteria |
java.util.ArrayList<BaseEntity[]> |
select(java.lang.String q,
BaseCollection[] peers,
java.sql.Connection conn)
Performs the given SQL select statement on the given collections represented by an array of BaseCollection objects |
protected java.util.ArrayList<BaseEntity> |
select(java.lang.String q,
BaseCollection peer,
java.sql.Connection conn)
Performs the given SQL select statement on the given collection represented by a BaseCollection object |
protected java.util.ArrayList<BaseEntity> |
selectAll(BaseCollection p,
java.sql.Connection conn)
Selects all objects from the given collection |
protected java.util.ArrayList<BaseEntity> |
selectAll(BaseCollection p,
java.lang.String orderBy,
java.sql.Connection conn)
Selects all objects from the given collection using an ORDER BY clause |
protected BaseEntity |
selectByPrimaryKey(BaseCollection peer,
java.lang.Object pk,
java.sql.Connection conn)
Selects an instance of BaseEntity for the given primary key |
protected void |
update(BaseCollection peer,
BaseEntity update,
BaseEntity where,
java.sql.Connection conn)
Performs the given SQL update statement on the given collection represented by a BaseCollection object |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.lang.String ORACLE_SUFFIX
protected final java.lang.String MSSQL_SUFFIX
| Constructor Detail |
|---|
public DatabaseOperations()
| Method Detail |
|---|
protected abstract void bindInputParameter(java.sql.PreparedStatement ps,
int type,
int index,
java.lang.Object value)
throws java.sql.SQLException
ps - The PreparedStatement object usedtype - Numeric representation of the parameter data typeindex - Index of the parameter in the prepared statementvalue - Value of the parameter
java.sql.SQLException
protected abstract void bindParameters(BaseCollection peer,
BaseEntity entity,
java.util.ArrayList<java.lang.String> names,
java.sql.PreparedStatement ps,
int initialIndex)
throws java.sql.SQLException
peer - The used BaseCollection objectentity - The used BaseEntity object from which parameter values are takennames - An ArrayList of parameters' namesps - The used PreparedStatement objectinitialIndex - The index with the parameters' binding shall start
java.sql.SQLException
public abstract BaseEntity mapResultSet(java.sql.ResultSet rs,
BaseCollection collection)
throws java.sql.SQLException
rs - The used ResultSet objectcollection - The used BaseCollection object
java.sql.SQLException
public abstract java.lang.Object save(BaseCollection peer,
BaseEntity bo,
java.sql.Connection conn)
throws java.sql.SQLException,
java.io.IOException
peer - The collection the BaseEntity object belongs tobo - The BaseEntity object to be savedconn - The used Connection object
java.sql.SQLException
java.io.IOException
public abstract void bindResourceParams(java.sql.PreparedStatement ps,
java.util.ArrayList<Parameter> params,
java.sql.Connection conn)
throws java.sql.SQLException,
java.io.IOException
ps - The used PreparedStatement objectparams - An ArrayList of the parameters to be boundconn - The used Connection object
java.sql.SQLException
java.io.IOException
public abstract void bindResourceCallParams(java.sql.CallableStatement cs,
java.util.ArrayList<Parameter> params,
java.sql.Connection conn)
throws java.sql.SQLException,
java.io.IOException
cs - The used CallableStatement objectparams - An ArrayList of the parameters to be boundconn - The used Connection object
java.sql.SQLException
java.io.IOExceptionprotected abstract int mapToSpecificTypeNumber(Column.GenericTypes genericType)
genericType -
public abstract void mapAndSetCallOutParam(java.sql.CallableStatement cs,
Parameter p)
throws java.sql.SQLException
cs - The used CallableStatement objectp - The parameter to be set
java.sql.SQLException
public java.util.ArrayList<BaseEntity> mapQuery(java.lang.String q,
BaseCollection peer,
java.sql.Connection conn)
throws java.sql.SQLException
q - The query to be mappedpeer - The BaseCollection object the entities to be returned belong toconn - The used Connection object
java.sql.SQLException
public java.util.ArrayList<BaseEntity> mapQuery(java.sql.PreparedStatement ps,
BaseCollection peer,
java.sql.Connection conn)
throws java.sql.SQLException
ps - The used PreparedStatement objectpeer - The BaseCollection object the entities to be returned belong toconn - The used Connection object
java.sql.SQLException
public java.util.ArrayList<BaseEntity[]> mapQuery(java.lang.String q,
BaseCollection[] peers,
java.sql.Connection conn)
throws java.sql.SQLException
q - The SQL query to be mappedpeers - Array of BaseCollection objectsconn - The used Connection object
java.sql.SQLException
protected java.util.ArrayList<BaseEntity> select(java.lang.String q,
BaseCollection peer,
java.sql.Connection conn)
throws java.sql.SQLException
q - The SQL select statement to be performedpeer - The BaseCollection object the select to be performed onconn - The used Connection object
java.sql.SQLException
public java.util.ArrayList<BaseEntity[]> select(java.lang.String q,
BaseCollection[] peers,
java.sql.Connection conn)
throws java.sql.SQLException
q - The SQL select statement to be performedpeers - The BaseCollection objects the select to be performed onconn - The used Connection object
java.sql.SQLException
protected void update(BaseCollection peer,
BaseEntity update,
BaseEntity where,
java.sql.Connection conn)
throws java.sql.SQLException
peer - The BaseCollection object the object to be updated belongs toupdate - BaseEntity object with update valueswhere - BaseEntity object with where criteriaconn - The used Connection object
java.sql.SQLException
protected void delete(BaseCollection peer,
BaseEntity where,
java.sql.Connection conn)
throws java.sql.SQLException
peer - The BaseCollection object the objects to be deleted belongs towhere - BaseEntity object with where criteriaconn - The used Connection object
java.sql.SQLException
protected java.util.ArrayList<BaseEntity> select(BaseCollection peer,
BaseEntity where,
java.lang.String orderBy,
java.sql.Connection conn)
throws java.sql.SQLException
peer - The used BaseCollection objectwhere - The BaseEntity object with select criteria setorderBy - The SQL 'ORDER BY' clauseconn - The used Connection object
java.sql.SQLException
protected java.util.ArrayList<BaseEntity> select(BaseCollection peer,
BaseEntity where,
java.sql.Connection conn)
throws java.sql.SQLException
peer - The used BaseCollection objectwhere - The BaseEntity object with select criteria setconn - The used Connection object
java.sql.SQLException
protected java.util.ArrayList<BaseEntity> selectAll(BaseCollection p,
java.sql.Connection conn)
throws java.sql.SQLException
p - The used BaseCollection objectconn - The used Connection object
java.sql.SQLException
protected java.util.ArrayList<BaseEntity> selectAll(BaseCollection p,
java.lang.String orderBy,
java.sql.Connection conn)
throws java.sql.SQLException
p - The used BaseCollection objectorderBy - The used ORDER BY clauseconn - The used Connection object
java.sql.SQLException
protected BaseEntity selectByPrimaryKey(BaseCollection peer,
java.lang.Object pk,
java.sql.Connection conn)
throws java.sql.SQLException
peer - The used BaseCollection collectionpk - The primary key of the searched objectconn - The used Connection object
java.sql.SQLException
public void execute(java.lang.String query,
java.sql.Connection conn)
throws java.sql.SQLException
query - The SQL statement to be executedconn - The used Connection object
java.sql.SQLException
protected void deleteByPrimaryKey(BaseCollection collection,
java.lang.Object primaryKey,
java.sql.Connection conn)
throws java.sql.SQLException
collection - The BaseCollection collection the instance belongs toprimaryKey - The primary key of the instance to be deletedconn - The used Connection object
java.sql.SQLException
protected static Column getColumn(BaseCollection instance,
java.lang.String columnName)
instance - The BaseCollection object the column belongs tocolumnName - The column name
protected Column getColumnForName(Column[] cols,
java.lang.String name)
cols - The array with Column objectsname - The name of the column to be retrieved
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||