|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.torque.util.BasePeer
@Deprecated public abstract class BasePeer
This is the base class for all Peer classes in the system. Peer classes are responsible for isolating all of the database access for a specific business object. They execute all of the SQL against the database. Over time this class has grown to include utility methods which ease execution of cross-database queries and the implementation of concrete Peers.
Constructor Summary | |
---|---|
BasePeer()
Deprecated. |
Method Summary | ||
---|---|---|
static void |
correctBooleans(ColumnValues columnValues)
Deprecated. Checks all columns in the criteria to see whether booleanchar and booleanint columns are queried with a boolean. |
|
static void |
correctBooleans(Criteria criteria)
Deprecated. Please use correctBooleans( org.apache.torque.criteria.Criteria, TableMap). This method will be removed in a future version of Torque. |
|
static void |
correctBooleans(Criteria criteria)
Deprecated. Checks all columns in the criteria to see whether booleanchar and booleanint columns are queried with a boolean. |
|
static int |
deleteAll(Connection con,
String table,
String column,
int value)
Deprecated. The value is not SQL escaped. Better use doDelete(Criteria, String, Connection) for automatic escaping and more flexibility. This method will be removed in a future version of Torque. |
|
static int |
deleteAll(String table,
String column,
int value)
Deprecated. The value is not SQL escaped. Better use doDelete(Criteria, String) for automatic escaping and more flexibility. This method will be removed in a future version of Torque. |
|
static int |
doDelete(Criteria criteria)
Deprecated. This method causes unexpected results when joins are used. Please use doDelete(org.apache.torque.criteria.Criteria, TableMap). This method will be removed in a future version of Torque. |
|
static int |
doDelete(Criteria criteria)
Deprecated. This method causes unexpected results when joins are used. Please use doDelete( org.apache.torque.criteria.Criteria, TableMap). This method will be removed in a future version of Torque. |
|
static int |
doDelete(Criteria criteria,
Connection con)
Deprecated. This method causes unexpected results when joins are used. Please use doDelete(org.apache.torque.criteria.Criteria, TableMap, Connection). This method will be removed in a future version of Torque. |
|
static int |
doDelete(Criteria criteria,
Connection con)
Deprecated. This method causes unexpected results when joins are used. Please use doDelete(org.apache.torque.criteria.Criteria, TableMap, Connection). This method will be removed in a future version of Torque. |
|
static ObjectKey |
doInsert(ColumnValues insertValues)
Deprecated. Inserts a record into a database table. |
|
static ObjectKey |
doInsert(ColumnValues insertValues,
Connection connection)
Deprecated. Inserts a record into a database table. |
|
static
|
doSelect(Criteria criteria,
RecordMapper<T> mapper)
Deprecated. Please use doSelect(org.apache.torque.criteria.Criteria, RecordMapper, TableMap). This method will be removed in a future version of Torque. |
|
static
|
doSelect(Criteria criteria,
RecordMapper<T> mapper)
Deprecated. Selects rows from a database an maps them to objects. |
|
static
|
doSelect(Criteria criteria,
RecordMapper<T> mapper,
Connection connection)
Deprecated. Please use doSelect(org.apache.torque.criteria.Criteria, RecordMapper, TableMap, Connection). This method will be removed in a future version of Torque. |
|
static
|
doSelect(Criteria criteria,
RecordMapper<T> mapper,
Connection connection)
Deprecated. Selects rows from a database an maps them to objects. |
|
static
|
doSelect(String query,
RecordMapper<T> mapper,
Connection connection)
Deprecated. Selects rows from a database an maps them to objects. |
|
static
|
doSelect(String query,
RecordMapper<T> mapper,
String dbName)
Deprecated. Selects rows from a database an maps them to objects. |
|
static
|
doSelectSingleRecord(Criteria criteria,
RecordMapper<T> mapper)
Deprecated. Selects at most a single row from a database an maps them to objects. |
|
static
|
doSelectSingleRecord(Criteria criteria,
RecordMapper<T> mapper,
Connection connection)
Deprecated. Selects at most a single row from a database an maps them to objects. |
|
static int |
doUpdate(ColumnValues updateValues)
Deprecated. Updates rows in the DB. |
|
static int |
doUpdate(ColumnValues updateValues,
Connection connection)
Deprecated. Updates rows in the DB. |
|
static int |
doUpdate(Criteria selectCriteria,
ColumnValues updateValues)
Deprecated. Please use doUpdate( org.apache.torque.criteria.Criteria, ColumnValues). This method will be removed in a future version of Torque. |
|
static int |
doUpdate(Criteria selectCriteria,
ColumnValues updateValues)
Deprecated. Executes an update against the database. |
|
static int |
doUpdate(Criteria criteria,
ColumnValues updateValues,
Connection connection)
Deprecated. Please use doUpdate(org.apache.torque.criteria.Criteria, ColumnValues, Connection). This method will be removed in a future version of Torque. |
|
static int |
doUpdate(Criteria criteria,
ColumnValues updateValues,
Connection connection)
Deprecated. Executes an update against the database. |
|
static int |
executeStatement(String statementString)
Deprecated. Utility method which executes a given SQL statement. |
|
static int |
executeStatement(String statementString,
Connection con)
Deprecated. Utility method which executes a given sql statement. |
|
static int |
executeStatement(String statementString,
String dbName)
Deprecated. Utility method which executes a given sql statement. |
|
static
|
getBasePeerImpl()
Deprecated. Returns an instance of the implementation of the peer. |
|
String[] |
initCriteriaKeys(String tableName,
String[] columnNames)
Deprecated. This method is not used any more and will be removed in a future version of Torque. |
|
static void |
setBasePeerImpl(BasePeerImpl<?> basePeerImpl)
Deprecated. Sets the implementation instance of this peer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasePeer()
Method Detail |
---|
public static <T> BasePeerImpl<T> getBasePeerImpl()
public static void setBasePeerImpl(BasePeerImpl<?> basePeerImpl)
basePeerImpl
- the implementation, or null to force creation of a
new instance.@Deprecated public String[] initCriteriaKeys(String tableName, String[] columnNames)
tableName
- Name of table.columnNames
- A String[].
@Deprecated public static int deleteAll(Connection con, String table, String column, int value) throws TorqueException
con
- A Connection.table
- The table to delete records from.column
- The column in the where clause.value
- The value of the column.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.@Deprecated public static int deleteAll(String table, String column, int value) throws TorqueException
table
- The table to delete records from.column
- The column in the where clause.value
- The value of the column.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.@Deprecated public static int doDelete(Criteria criteria) throws TorqueException
criteria
- The criteria to use.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.@Deprecated public static int doDelete(Criteria criteria) throws TorqueException
criteria
- The criteria to use.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.@Deprecated public static int doDelete(Criteria criteria, Connection con) throws TorqueException
criteria
- The criteria to use.con
- A Connection.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.@Deprecated public static int doDelete(Criteria criteria, Connection con) throws TorqueException
criteria
- The criteria to use.con
- A Connection.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static ObjectKey doInsert(ColumnValues insertValues) throws TorqueException
If the primary key is included in Criteria, then that value will be used to insert the row.
Otherwise, if the primary key can be generated automatically, the generated key will be used for the insert and will be returned.
If no value is given for the primary key is defined and it cannot be generated automatically or the table has no primary key, the values will be inserted as specified and null will be returned.
insertValues
- Contains the values to insert, not null.
TorqueException
- if a database error occurs.public static ObjectKey doInsert(ColumnValues insertValues, Connection connection) throws TorqueException
If the primary key is included in Criteria, then that value will be used to insert the row.
Otherwise, if the primary key can be generated automatically, the generated key will be used for the insert and will be returned.
If no value is given for the primary key is defined and it cannot be generated automatically or the table has no primary key, the values will be inserted as specified and null will be returned.
insertValues
- Contains the values to insert, not null.connection
- the connection to use for the insert, not null.
TorqueException
- if a database error occurs.@Deprecated public static <T> List<T> doSelect(Criteria criteria, RecordMapper<T> mapper) throws TorqueException
criteria
- A Criteria specifying the records to select, not null.mapper
- The mapper creating the objects from the resultSet,
not null.
TorqueException
- if querying the database fails.public static <T> List<T> doSelect(Criteria criteria, RecordMapper<T> mapper) throws TorqueException
criteria
- A Criteria specifying the records to select, not null.mapper
- The mapper creating the objects from the resultSet,
not null.
TorqueException
- if querying the database fails.@Deprecated public static <T> List<T> doSelect(Criteria criteria, RecordMapper<T> mapper, Connection connection) throws TorqueException
criteria
- A Criteria specifying the records to select, not null.mapper
- The mapper creating the objects from the resultSet,
not null.connection
- the database connection for selecting records,
not null.
TorqueException
- Error performing database query.public static <T> List<T> doSelect(Criteria criteria, RecordMapper<T> mapper, Connection connection) throws TorqueException
criteria
- A Criteria specifying the records to select, not null.mapper
- The mapper creating the objects from the resultSet,
not null.connection
- the database connection for selecting records,
not null.
TorqueException
- Error performing database query.public static <T> List<T> doSelect(String query, RecordMapper<T> mapper, String dbName) throws TorqueException
query
- the sql query to execute, not null.mapper
- The mapper creating the objects from the resultSet,
not null.dbName
- The name of the database to create the connection for,
or null for the default SDB.
TorqueException
- if querying the database fails.public static <T> List<T> doSelect(String query, RecordMapper<T> mapper, Connection connection) throws TorqueException
query
- the SQL Query to execute, not null.mapper
- The mapper creating the objects from the resultSet,
not null.connection
- the database connection, not null.
TorqueException
- if querying the database fails.public static <T> T doSelectSingleRecord(Criteria criteria, RecordMapper<T> mapper) throws TorqueException
criteria
- A Criteria specifying the records to select, not null.mapper
- The mapper creating the objects from the resultSet,
not null.
TorqueException
- if querying the database fails.public static <T> T doSelectSingleRecord(Criteria criteria, RecordMapper<T> mapper, Connection connection) throws TorqueException
criteria
- A Criteria specifying the records to select, not null.mapper
- The mapper creating the objects from the resultSet,
not null.connection
- the database connection, not null.
TorqueException
- if querying the database fails.public static int doUpdate(ColumnValues updateValues) throws TorqueException
Use this method for performing an update of the kind:
"WHERE primary_key_id = someValue"
To perform an update on a table with multiple primary keys or an update with non-primary key fields in the WHERE clause, use doUpdate(ColumnValues, Criteria).
updateValues
- Which columns to update with which values
for which primary key value, not null.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static int doUpdate(ColumnValues updateValues, Connection connection) throws TorqueException
Use this method for performing an update of the kind:
"WHERE primary_key_id = someValue"
To perform an update on a table with multiple primary keys or an update with non-primary key fields in the WHERE clause, use doUpdate(ColumnValues, Criteria, Connection).
updateValues
- Which columns to update with which values
for which primary key value, not null.connection
- the database connection to use.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.@Deprecated public static int doUpdate(Criteria selectCriteria, ColumnValues updateValues) throws TorqueException
criteria
and updated using the values
in updateValues
.
selectCriteria
- selects which rows of which table
should be updated, not null.updateValues
- Which columns to update with which values, not null.
TorqueException
- if updating fails.public static int doUpdate(Criteria selectCriteria, ColumnValues updateValues) throws TorqueException
criteria
and updated using the values
in updateValues
.
selectCriteria
- selects which rows of which table
should be updated, not null.updateValues
- Which columns to update with which values, not null.
TorqueException
- if updating fails.@Deprecated public static int doUpdate(Criteria criteria, ColumnValues updateValues, Connection connection) throws TorqueException
criteria
and updated using the values
in updateValues
.
criteria
- selects which rows of which table should be updated.updateValues
- Which columns to update with which values, not null.connection
- the database connection to use, not null.
TorqueException
- if updating fails.public static int doUpdate(Criteria criteria, ColumnValues updateValues, Connection connection) throws TorqueException
criteria
and updated using the values
in updateValues
.
criteria
- selects which rows of which table should be updated.updateValues
- Which columns to update with which values, not null.connection
- the database connection to use, not null.
TorqueException
- if updating fails.public static int executeStatement(String statementString) throws TorqueException
statementString
- A String with the SQL statement to execute.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static int executeStatement(String statementString, String dbName) throws TorqueException
statementString
- A String with the sql statement to execute.dbName
- Name of database to connect to.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static int executeStatement(String statementString, Connection con) throws TorqueException
statementString
- A String with the sql statement to execute.con
- A Connection.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.@Deprecated public static void correctBooleans(Criteria criteria) throws TorqueException
criteria
- The criteria to be checked for booleanint and booleanchar
columns.
TorqueException
- if the database map for the criteria cannot be
retrieved.public static void correctBooleans(Criteria criteria) throws TorqueException
criteria
- The criteria to be checked for booleanint and booleanchar
columns.
TorqueException
- if the database map for the criteria cannot be
retrieved.public static void correctBooleans(ColumnValues columnValues) throws TorqueException
columnValues
- The value to be checked for booleanint
and booleanchar columns.
TorqueException
- if the database map for the criteria cannot be
retrieved.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |