com.j256.ormlite.stmt.mapped
Class BaseMappedStatement<T,ID>

java.lang.Object
  extended by com.j256.ormlite.stmt.mapped.BaseMappedStatement<T,ID>
Direct Known Subclasses:
BaseMappedQuery, MappedCreate, MappedDelete, MappedDeleteCollection, MappedUpdate, MappedUpdateId

public abstract class BaseMappedStatement<T,ID>
extends Object

Abstract mapped statement which has common statements used by the subclasses.

Author:
graywatson

Field Summary
protected  FieldType[] argFieldTypes
           
protected  FieldType idField
           
protected static Logger logger
           
protected  String statement
           
protected  TableInfo<T,ID> tableInfo
           
 
Constructor Summary
protected BaseMappedStatement(TableInfo<T,ID> tableInfo, String statement, FieldType[] argFieldTypes)
           
 
Method Summary
protected  Object convertIdToFieldObject(ID id)
          Return a field object converted from an id.
 int delete(DatabaseConnection databaseConnection, T data)
          Delete the object from the database.
protected  Object extractIdToFieldObject(T data)
          Return a field-object for the id extracted from the data.
protected  Object[] getFieldObjects(Object data)
          Return the array of field objects pulled from the data object.
 String getStatement()
           
protected  int insert(DatabaseConnection databaseConnection, T data)
          Insert the object into the database
 String toString()
           
 int update(DatabaseConnection databaseConnection, T data)
          Update the object in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected static Logger logger

tableInfo

protected final TableInfo<T,ID> tableInfo

idField

protected final FieldType idField

statement

protected final String statement

argFieldTypes

protected final FieldType[] argFieldTypes
Constructor Detail

BaseMappedStatement

protected BaseMappedStatement(TableInfo<T,ID> tableInfo,
                              String statement,
                              FieldType[] argFieldTypes)
Method Detail

insert

protected int insert(DatabaseConnection databaseConnection,
                     T data)
              throws SQLException
Insert the object into the database

Throws:
SQLException

update

public int update(DatabaseConnection databaseConnection,
                  T data)
           throws SQLException
Update the object in the database.

Throws:
SQLException

delete

public int delete(DatabaseConnection databaseConnection,
                  T data)
           throws SQLException
Delete the object from the database.

Throws:
SQLException

getStatement

public String getStatement()

getFieldObjects

protected Object[] getFieldObjects(Object data)
                            throws SQLException
Return the array of field objects pulled from the data object.

Throws:
SQLException

convertIdToFieldObject

protected Object convertIdToFieldObject(ID id)
                                 throws SQLException
Return a field object converted from an id.

Throws:
SQLException

extractIdToFieldObject

protected Object extractIdToFieldObject(T data)
                                 throws SQLException
Return a field-object for the id extracted from the data.

Throws:
SQLException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.