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`

public abstract class AbstractPeerImpl<T extends ObjectModel> extends BasePeerImpl<T>
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:
  - Serialisierte Form

- ## Konstruktorübersicht

  Konstruktoren
  Konstruktor
  Beschreibung
  `AbstractPeerImpl()`
  Default constructor
  `AbstractPeerImpl(RecordMapper<T> recordMapper, TableMap tableMap, String databaseName)`
  Constructor providing the objects to be injected as parameters.

- ## Methodenübersicht

  Modifizierer und Typ
  Methode
  Beschreibung
  `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.

  ### 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`

  ### Von Klasse geerbte Methoden java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Konstruktordetails

  - ### AbstractPeerImpl

    public AbstractPeerImpl()
    Default constructor

  - ### AbstractPeerImpl

    public AbstractPeerImpl(RecordMapper<T> recordMapper, TableMap tableMap, String databaseName)
    Constructor providing the objects to be injected as parameters.
    Parameter:
      `recordMapper` - a record mapper to map JDBC result sets to objects
      `tableMap` - the default table map
      `databaseName` - the name of the database

- ## Methodendetails

  - ### buildCriteria

    public abstract Criteria buildCriteria(T obj)
    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

    public abstract Criteria buildSelectCriteria(T obj)
    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

    public Criteria buildCriteria(ObjectKey<?> pk)
    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

    public abstract ColumnValues buildColumnValues(T obj) throws TorqueException
    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

    public List<T> doSelect(T obj) throws TorqueException
    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

    public T doSelectSingleRecord(T obj) throws TorqueException
    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

    public ObjectKey<?> doInsert(ColumnValues columnValues, Connection con) throws TorqueException
    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 Klasse `BasePeerImpl<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

    public void doInsert(T obj) throws TorqueException
    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

    public void doInsert(T obj, Connection con) throws TorqueException
    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

    public int doUpdate(T obj) throws TorqueException
    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

    public int doUpdate(T obj, Connection con) throws TorqueException
    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

    public int doDelete(ObjectKey<?> pk) throws TorqueException
    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

    public int doDelete(ObjectKey<?> pk, Connection con) throws TorqueException
    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.