Package org.apache.torque.util
Klasse AbstractPeerImpl<T extends ObjectModel>
java.lang.Object
org.apache.torque.util.BasePeerImpl<T>
org.apache.torque.util.AbstractPeerImpl<T>
- Typparameter:
T
- The data object class for this Peer.
- Alle implementierten Schnittstellen:
Serializable
This is an abstract layer for all generated peer classes that
implements several convenience methods that otherwise would have
to be generated.
- Version:
- $Id: BasePeerImpl.java 1701342 2015-09-05 02:18:04Z tfischer $
- Autor:
- Thomas Vandahl
- Siehe auch:
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungDefault constructorAbstractPeerImpl
(RecordMapper<T> recordMapper, TableMap tableMap, String databaseName) Constructor providing the objects to be injected as parameters. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungabstract ColumnValues
buildColumnValues
(T obj) Returns the contents of the object as ColumnValues object.buildCriteria
(ObjectKey<?> pk) Build a Criteria object which selects all objects which have a given primary key.abstract Criteria
buildCriteria
(T obj) Build a Criteria object from the data object for this peer.abstract Criteria
buildSelectCriteria
(T obj) Build a Criteria object from the data object for this peer, skipping all binary columns.int
Deletes a row in the database.int
doDelete
(ObjectKey<?> pk, Connection con) Deletes a row in the database.ObjectKey<?>
doInsert
(ColumnValues columnValues, Connection con) Method to do inserts.void
Method to do insertsvoid
doInsert
(T obj, Connection con) Method to do inserts.Selects objects from the database which have the same content as the passed object.doSelectSingleRecord
(T obj) Selects at most one object from the database which has the same content as the passed object.int
Updates an object in the database.int
doUpdate
(T obj, Connection con) Updates an object in the database.Von Klasse geerbte Methoden org.apache.torque.util.BasePeerImpl
addSelectColumns, correctBooleans, correctBooleans, doDelete, doDelete, doInsert, doInsert, doInsert, doInsert, doInsert, doSelect, doSelect, doSelect, doSelect, doSelect, doSelect, doSelect, doSelect, doSelectAsStream, doSelectAsStream, doSelectAsStream, doSelectAsStream, doSelectSingleRecord, doSelectSingleRecord, doSelectSingleRecord, doSelectSingleRecord, doUpdate, doUpdate, doUpdate, doUpdate, executeStatement, executeStatement, executeStatement, executeStatement, executeStatement, executeStatement, executeStatement, getDatabaseName, getRecordMapper, getTableMap, setDatabaseName, setDbName, setRecordMapper, setTableMap
-
Konstruktordetails
-
AbstractPeerImpl
public AbstractPeerImpl()Default constructor -
AbstractPeerImpl
Constructor providing the objects to be injected as parameters.- Parameter:
recordMapper
- a record mapper to map JDBC result sets to objectstableMap
- the default table mapdatabaseName
- the name of the database
-
-
Methodendetails
-
buildCriteria
Build a Criteria object from the data object for this peer.- Parameter:
obj
- the object to build the criteria from, not null.- Gibt zurück:
- Criteria object
-
buildSelectCriteria
Build a Criteria object from the data object for this peer, skipping all binary columns.- Parameter:
obj
- the object to build the criteria from, not null.- Gibt zurück:
- Criteria object
-
buildCriteria
Build a Criteria object which selects all objects which have a given primary key. This method should never be called because if the table has a primary key, it must be overridden in the generated code.- Parameter:
pk
- the primary key value to build the criteria from, not null.- Gibt zurück:
- Criteria object
-
buildColumnValues
Returns the contents of the object as ColumnValues object. Primary key columns which are generated on insertion are not added to the returned object if they still have their initial value. Also, columns which have the useDatabaseDefaultValue flag set to true are also not added to the returned object if they still have their initial value.- Parameter:
obj
- the object to build the column values from- Gibt zurück:
- ColumnValues object
- Löst aus:
TorqueException
- if the table map cannot be retrieved (should not happen).
-
doSelect
Selects objects from the database which have the same content as the passed object.- Parameter:
obj
- the data object- Gibt zurück:
- The list of selected objects, not null.
- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
doSelectSingleRecord
Selects at most one object from the database which has the same content as the passed object.- Parameter:
obj
- the data object- Gibt zurück:
- the selected Object, or null if no object was selected.
- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
doInsert
Method to do inserts. This method is to be used during a transaction, otherwise use the doInsert(Criteria) method.- Setzt außer Kraft:
doInsert
in KlasseBasePeerImpl<T extends ObjectModel>
- Parameter:
columnValues
- the values to insert.con
- the connection to use, not null.- Gibt zurück:
- the primary key of the inserted row or null if the table has no primary key
- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
doInsert
Method to do inserts- Parameter:
obj
- the data object- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
doInsert
Method to do inserts. This method is to be used during a transaction, otherwise use the doInsert(T) method. It will take care of the connection details internally.- Parameter:
obj
- the data object to insert into the database.con
- the connection to use- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
doUpdate
Updates an object in the database. The primary key is used to identify the object to update.- Parameter:
obj
- the data object to update in the database.- Gibt zurück:
- the number of affected rows.
- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
doUpdate
Updates an object in the database. The primary key is used to identify the object to update. This method is to be used during a transaction, otherwise the doUpdate(T) method can be used.- Parameter:
obj
- the data object to update in the database.con
- the connection to use, not null.- Gibt zurück:
- the number of affected rows.
- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
doDelete
Deletes a row in the database.- Parameter:
pk
- the ObjectKey that identifies the row to delete.- Gibt zurück:
- the number of deleted rows.
- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
doDelete
Deletes a row in the database. This method is to be used during a transaction, otherwise use the doDelete(ObjectKey) method.- Parameter:
pk
- the ObjectKey that identifies the row to delete.con
- the connection to use for deleting, not null.- Gibt zurück:
- the number of deleted rows.
- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-