T
- The data object class for this Peer.public abstract class AbstractPeerImpl<T extends ObjectModel> extends BasePeerImpl<T>
Constructor and Description |
---|
AbstractPeerImpl()
Default constructor
|
AbstractPeerImpl(RecordMapper<T> recordMapper,
TableMap tableMap,
String databaseName)
Constructor providing the objects to be injected as parameters.
|
Modifier and Type | Method and Description |
---|---|
abstract ColumnValues |
buildColumnValues(T obj)
Returns the contents of the object as ColumnValues object.
|
Criteria |
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 |
doDelete(ObjectKey<?> pk)
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 |
doInsert(T obj)
Method to do inserts
|
void |
doInsert(T obj,
Connection con)
Method to do inserts.
|
List<T> |
doSelect(T obj)
Selects objects from the database which have
the same content as the passed object.
|
T |
doSelectSingleRecord(T obj)
Selects at most one object from the database
which has the same content as the passed object.
|
int |
doUpdate(T obj)
Updates an object in the database.
|
int |
doUpdate(T obj,
Connection con)
Updates an object in the database.
|
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
public AbstractPeerImpl()
public AbstractPeerImpl(RecordMapper<T> recordMapper, TableMap tableMap, String databaseName)
recordMapper
- a record mapper to map JDBC result sets to objectstableMap
- the default table mapdatabaseName
- the name of the databasepublic abstract Criteria buildCriteria(T obj)
obj
- the object to build the criteria from, not null.public abstract Criteria buildSelectCriteria(T obj)
obj
- the object to build the criteria from, not null.public Criteria buildCriteria(ObjectKey<?> pk)
pk
- the primary key value to build the criteria from, not null.public abstract ColumnValues buildColumnValues(T obj) throws TorqueException
obj
- the object to build the column values fromTorqueException
- if the table map cannot be retrieved
(should not happen).public List<T> doSelect(T obj) throws TorqueException
obj
- the data objectTorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public T doSelectSingleRecord(T obj) throws TorqueException
obj
- the data objectTorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public ObjectKey<?> doInsert(ColumnValues columnValues, Connection con) throws TorqueException
doInsert
in class BasePeerImpl<T extends ObjectModel>
columnValues
- the values to insert.con
- the connection to use, not null.TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public void doInsert(T obj) throws TorqueException
obj
- the data objectTorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public void doInsert(T obj, Connection con) throws TorqueException
obj
- the data object to insert into the database.con
- the connection to useTorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public int doUpdate(T obj) throws TorqueException
obj
- the data object to update in the database.TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public int doUpdate(T obj, Connection con) throws TorqueException
obj
- the data object to update in the database.con
- the connection to use, not null.TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public int doDelete(ObjectKey<?> pk) throws TorqueException
pk
- the ObjectKey that identifies the row to delete.TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public int doDelete(ObjectKey<?> pk, Connection con) throws TorqueException
pk
- the ObjectKey that identifies the row to delete.con
- the connection to use for deleting, not null.TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.