com.youyounet.db
Class Table

java.lang.Object
  |
  +--com.youyounet.db.Table

public class Table
extends java.lang.Object

Table is the class that encapsulate the common database operations in its methods calls. Each data bean class is designed to map to a database table and will have a class-wide(statically declared) table object. This Table object is responsible for the database operations initiated by the actual data bean instances. In the most cases, users will not directly call this Table class' methods except for a few static ones. Rather, users will normally code their data bean class according to a preset pattern and the data bean class will then inherite the database functionalities from its abstract ancestor class.

See Also:
DataBean

Field Summary
protected  java.lang.Class cls
           
protected  java.util.Vector columns
           
protected  java.lang.String deleteSql
           
protected  java.util.Hashtable fieldMap
           
protected  java.lang.String insertSql
           
protected  java.lang.String key
           
protected static java.util.logging.Logger log
           
protected  int nColumns
           
protected  java.lang.String selectSql
           
protected  java.lang.String tableName
           
protected  java.lang.String updateSql
           
 
Constructor Summary
Table(java.lang.String tableName, java.lang.String className, java.util.Hashtable fieldMap)
          public constructor
Table(java.lang.String tableName, java.lang.String className, java.util.Hashtable fieldMap, java.lang.String key)
          public constructor.
 
Method Summary
protected  java.util.Vector buildColumns()
           
 boolean create(java.lang.Object obj)
          Insert the data bean obj as a new row to the corresponding database table.
 boolean create(java.lang.Object obj, boolean ignorAutoIncrement)
          Insert the data bean obj as a new row to the corresponding database table.
 boolean create(java.lang.Object obj, java.sql.Connection con)
          Insert the data bean obj as a new row to the corresponding database table.
 boolean create(java.lang.Object obj, java.sql.Connection con, boolean ignorAutoIncrement)
          Insert the data bean obj as a new row to the corresponding database table.
 int delete(java.lang.String condition)
          Delete data beans from this table using the condition specified.
 int delete(java.lang.String condition, java.sql.Connection con)
          Delete data beans from this table using the condition specified.
static int delete(java.lang.String table, java.lang.String condition)
          Delete data beans from the table using the condition specified.
static int delete(java.lang.String table, java.lang.String condition, java.sql.Connection con)
          Delete from the database table, using the condition specified.
 boolean exists(java.lang.Object obj)
          check if the data bean obj exists in the table.
 boolean find(java.lang.Object obj, java.lang.String condition)
          Check whether the data bean obj exists in the corresponding table satisfied by the additional SQL condition if present.
 java.lang.String getColumnNamesAsString(java.lang.String prefix)
          Get a string of all the column names of this table.
 java.lang.String getKey(java.util.Hashtable fieldMap)
          Get the name of the primary key column.
 java.lang.String getKeyColumnName()
          Get the name of the primary key column.
protected  java.lang.String getKeyCondition(java.lang.Object obj)
          if there is a primary key, a string representing a SQL condition "primaryKey=value" will be returned.
 java.lang.Object getMaxID(java.lang.String indexColumnName, java.sql.Connection con)
          Get the max value of the indexColumnName column.
 java.lang.Object getMaxPrimaryKey(java.sql.Connection con)
          Get the max value of the primary key column, if there is a primary key for this table.
 java.lang.String getName()
          Get the name of the table.
 java.util.Iterator iterator()
          returns a bean Iterator.
 java.util.Iterator iterator(java.lang.String condition)
          returns a bean Iterator.
 java.util.Iterator iterator(java.lang.String tables, java.lang.String condition)
          returns a bean Iterator.
 boolean load(java.lang.Object obj)
          load the databean obj's property from the database table, using the SQL condition specified by getKeyCondition method
 boolean load(java.lang.Object obj, java.sql.Connection con)
          load the databean obj's property from the database table, using the SQL condition specified by getKeyCondition method
 boolean load(java.lang.Object obj, java.lang.String condition)
          load the databean obj's property from the database table, using the condition specified
 boolean load(java.lang.Object obj, java.lang.String condition, java.sql.Connection con)
          load the databean obj's property from the database table, using the condition specified
 boolean remove(java.lang.Object obj)
          Remove the databean obj from the database table, using the condition specified by getKeyCondition method.
 boolean remove(java.lang.Object obj, java.sql.Connection con)
          Remove the databean obj from the database table, using the condition specified by getKeyCondition method.
 boolean remove(java.lang.Object obj, java.lang.String condition)
          Remove the data bean obj from the database table, using the condition specified.
 boolean remove(java.lang.Object obj, java.lang.String condition, java.sql.Connection con)
          Remove the databean obj from the database table, using the condition specified.
 java.util.Vector select(java.lang.String condition, java.lang.String orderBy)
          Select a Vector of data beans satisfied by the passed in SQL condition.
 java.util.Vector select(java.lang.String condition, java.lang.String orderBy, java.sql.Connection con)
          Select a Vector of data beans satisfied by the passed in SQL condition.
 java.util.Vector select(java.lang.String tableList, java.lang.String condition, java.lang.String orderBy)
          Select a Vector of data beans from this table that is satisfied by the passed in SQL condition.
 java.util.Vector select(java.lang.String tableList, java.lang.String condition, java.lang.String orderBy, java.sql.Connection con)
          Select a Vector of data beans from this table that is satisfied by the passed in SQL condition.
static java.util.Vector select(java.lang.String tableList, java.lang.String columnList, java.lang.String condition, java.lang.String orderBy)
          A static method to select a vector of SimpleBean objects.
static java.util.Vector select(java.lang.String tableList, java.lang.String columnList, java.lang.String condition, java.lang.String orderBy, java.sql.Connection con)
          A static method to select a vector of SimpleBean objects.
protected  void setSQL()
           
 boolean store(java.lang.Object obj)
          Store the data bean obj's property value to the database table, using the condition get from getKeyCondition method.
 boolean store(java.lang.Object obj, java.sql.Connection con)
          store the databean obj's property value to the database table, using the condition specified by getKeyCondition method.
 boolean store(java.lang.Object obj, java.lang.String condition)
          store the databean obj's property value to the associated table, using the condition specified.
 boolean store(java.lang.Object obj, java.lang.String condition, java.sql.Connection con)
          store the databean obj's property value to the database table, using the condition specified.
 int update(java.lang.Object obj, java.util.Vector columnNames, java.lang.String condition)
          Update one or more data beans' value in the table with value drawn from the passed in data bean obj.
 int update(java.lang.Object obj, java.util.Vector columnNames, java.lang.String condition, java.sql.Connection con)
          Update one or more data beans' value in the table with value drawn from the passed in data bean obj.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static java.util.logging.Logger log

tableName

protected java.lang.String tableName

cls

protected java.lang.Class cls

columns

protected java.util.Vector columns

fieldMap

protected java.util.Hashtable fieldMap

nColumns

protected int nColumns

key

protected java.lang.String key

selectSql

protected java.lang.String selectSql

updateSql

protected java.lang.String updateSql

deleteSql

protected java.lang.String deleteSql

insertSql

protected java.lang.String insertSql
Constructor Detail

Table

public Table(java.lang.String tableName,
             java.lang.String className,
             java.util.Hashtable fieldMap)
public constructor


Table

public Table(java.lang.String tableName,
             java.lang.String className,
             java.util.Hashtable fieldMap,
             java.lang.String key)
public constructor.

Method Detail

getKeyColumnName

public java.lang.String getKeyColumnName()
Get the name of the primary key column. If there is no primary key, null will be returned.


getKey

public java.lang.String getKey(java.util.Hashtable fieldMap)
Get the name of the primary key column. If there is no primary key, null will be returned.


getName

public java.lang.String getName()
Get the name of the table.


setSQL

protected void setSQL()

buildColumns

protected java.util.Vector buildColumns()

getColumnNamesAsString

public java.lang.String getColumnNamesAsString(java.lang.String prefix)
Get a string of all the column names of this table. If parameter prefix is not null, all the column names will be prepended with the prefix followed by a dot(.).

Parameters:
prefix - the prefix to be added to all the column names.

getKeyCondition

protected java.lang.String getKeyCondition(java.lang.Object obj)
if there is a primary key, a string representing a SQL condition "primaryKey=value" will be returned. Otherwise an empty string will be returned. The primaryKey's value will be drawn from the passed in obj's corresponding value

Parameters:
obj - whose corresponding value will be used to set the SQL condition for the primary key

load

public boolean load(java.lang.Object obj,
                    java.lang.String condition)
             throws java.sql.SQLException,
                    DataTransferException
load the databean obj's property from the database table, using the condition specified

Parameters:
obj - the databean object whose property value will be set from the values get from the database
condition - the SQL condition used to load the data from the database
Returns:
a boolean value indicating the load is successful or not, true means the load is completed
Throws:
java.sql.SQLException
DataTransferException

load

public boolean load(java.lang.Object obj,
                    java.lang.String condition,
                    java.sql.Connection con)
             throws java.sql.SQLException,
                    DataTransferException
load the databean obj's property from the database table, using the condition specified

Parameters:
obj - the databean object whose property value will be set from the values get from the database
condition - the SQL condition used to load the data from the database
con - the load operation is part of the database transaction associated with this connection object
Returns:
a boolean value indicating the load is successful or not, true means the load is completed
Throws:
java.sql.SQLException
DataTransferException

load

public boolean load(java.lang.Object obj)
             throws java.sql.SQLException,
                    DataTransferException
load the databean obj's property from the database table, using the SQL condition specified by getKeyCondition method

Parameters:
obj - the databean object whose property value will be set from the values get from the database
Returns:
a boolean value indicating the load is successful or not, true means the load is completed
Throws:
java.sql.SQLException
DataTransferException

load

public boolean load(java.lang.Object obj,
                    java.sql.Connection con)
             throws DataTransferException,
                    java.sql.SQLException
load the databean obj's property from the database table, using the SQL condition specified by getKeyCondition method

Parameters:
obj - the databean object whose property value will be set from the values get from the database
con - the load operation is part of the database transaction associated with this connection object
Returns:
a boolean value indicating the load is successful or not, true means the load is completed
Throws:
java.sql.SQLException
DataTransferException

store

public boolean store(java.lang.Object obj,
                     java.lang.String condition)
              throws DataTransferException,
                     java.sql.SQLException
store the databean obj's property value to the associated table, using the condition specified.

Parameters:
obj - the databean object whose property value will be stored to the corresponding table
condition - the SQL condition used to store the obj's property value to the database
Returns:
a boolean value indicating the store is successful or not, true means the store is completed successfully
Throws:
java.sql.SQLException
DataTransferException

store

public boolean store(java.lang.Object obj,
                     java.lang.String condition,
                     java.sql.Connection con)
              throws DataTransferException,
                     java.sql.SQLException
store the databean obj's property value to the database table, using the condition specified.

Parameters:
obj - the databean object whose property value will be stored to the corresponding table
condition - the SQL condition used to store the obj's property value to the database
con - the store operation is part of the database transaction associated with this connection object
Returns:
a boolean value indicating the store is successful or not, true means the store is completed successfully
Throws:
java.sql.SQLException
DataTransferException

store

public boolean store(java.lang.Object obj)
              throws DataTransferException,
                     java.sql.SQLException
Store the data bean obj's property value to the database table, using the condition get from getKeyCondition method.

Parameters:
obj - the databean object whose property value will be stored to the corresponding table
Returns:
a boolean value indicating the store is successful or not, true means the store is completed successfully
Throws:
java.sql.SQLException
DataTransferException

store

public boolean store(java.lang.Object obj,
                     java.sql.Connection con)
              throws DataTransferException,
                     java.sql.SQLException
store the databean obj's property value to the database table, using the condition specified by getKeyCondition method.

Parameters:
obj - the databean object whose property value will be stored to the corresponding table
con - the store operation is part of the database transaction associated with this connection object
Returns:
a boolean value indicating the store is successful or not, true means the store is completed successfully
Throws:
java.sql.SQLException
DataTransferException

delete

public static int delete(java.lang.String table,
                         java.lang.String condition)
                  throws java.sql.SQLException
Delete data beans from the table using the condition specified.

Parameters:
table - the table name
condition - the SQL condition used in the delete operation
Returns:
an int indicating the number of records were deleted
Throws:
java.sql.SQLException

delete

public static int delete(java.lang.String table,
                         java.lang.String condition,
                         java.sql.Connection con)
                  throws java.sql.SQLException
Delete from the database table, using the condition specified.

Parameters:
table - the table name
condition - the SQL condition used in the delete operation
Returns:
an int indicating the number of records were deleted
Throws:
java.sql.SQLException

delete

public int delete(java.lang.String condition)
           throws java.sql.SQLException
Delete data beans from this table using the condition specified.

Parameters:
condition - the SQL condition used in the delete operation
Returns:
an int indicating the number of records were deleted
Throws:
java.sql.SQLException

delete

public int delete(java.lang.String condition,
                  java.sql.Connection con)
           throws java.sql.SQLException
Delete data beans from this table using the condition specified.

Parameters:
condition - the SQL condition used in the delete operation
con - the delete operation is part of the transaction associated with the Connection object
Returns:
an int indicating the number of records were deleted
Throws:
java.sql.SQLException

remove

public boolean remove(java.lang.Object obj,
                      java.lang.String condition)
               throws DataTransferException,
                      java.sql.SQLException
Remove the data bean obj from the database table, using the condition specified.

The difference of a remove method and a delete method is that a remove method can only remove the passed in data bean itself from this table, while a delete method may delete multiple data beans from this table. The data beans that will be deleted from the call to the delete method will be determined by the SQL condition passed in.

Parameters:
obj - the databean object will be removed from the database
condition - the SQL condition used to remove the data from the database
Returns:
a boolean value indicating the remove is successful or not, true means the remove is completed successfully
Throws:
java.sql.SQLException
DataTransferException - if more than one object would be removed based on the specified SQL condition.

remove

public boolean remove(java.lang.Object obj,
                      java.lang.String condition,
                      java.sql.Connection con)
               throws DataTransferException,
                      java.sql.SQLException
Remove the databean obj from the database table, using the condition specified.

The difference of a remove method and a delete method is that a remove method can only remove the calling data bean itself from the table, while a delete method will not necesalary delete the calling data bean from the table and doesn't even require that the calling data bean exists in the table. The data beans that will be deleted from the call to the delete method will be determined by the SQL condition passed in.

Parameters:
obj - the databean object will be removed from the database
condition - the SQL condition used to remove the data from the database
con - the remove operation is part of the transaction associated with the Connection Object
Returns:
a boolean value indicating the remove is successful or not, true means the remove is completed successfully
Throws:
java.sql.SQLException
DataTransferException
java.sql.SQLException
DataTransferException - if more than one bean would be removed from the table under the specified condition.

remove

public boolean remove(java.lang.Object obj)
               throws DataTransferException,
                      java.sql.SQLException
Remove the databean obj from the database table, using the condition specified by getKeyCondition method.

The difference of a remove method and a delete method is that a remove method can only remove the calling data bean itself from the table, while a delete method will not necesalary delete the calling data bean from the table and doesn't even require that the calling data bean exists in the table. The data beans that will be deleted from the call to the delete method will be determined by the SQL condition passed in.

Parameters:
obj - the databean object will be removed from the database
Returns:
a boolean value indicating the remove is successful or not, true means the remove is completed successfully
Throws:
java.sql.SQLException
DataTransferException
java.sql.SQLException
DataTransferException

remove

public boolean remove(java.lang.Object obj,
                      java.sql.Connection con)
               throws DataTransferException,
                      java.sql.SQLException
Remove the databean obj from the database table, using the condition specified by getKeyCondition method.

The difference of a remove method and a delete method is that a remove method can only remove the calling data bean itself from the table, while a delete method will not necesalary delete the calling data bean from the table and doesn't even require that the calling data bean exists in the table. The data beans that will be deleted from the call to the delete method will be determined by the SQL condition passed in.

Parameters:
obj - the databean object will be removed from the database
con - the remove operation is part of the transaction associated with the Connection object
Returns:
a boolean value indicating the remove is successful or not, true means the remove is completed successfully
Throws:
java.sql.SQLException
DataTransferException
java.sql.SQLException
DataTransferException

create

public boolean create(java.lang.Object obj)
               throws DataTransferException,
                      java.sql.SQLException
Insert the data bean obj as a new row to the corresponding database table. If there is an auto increment column in the table, the default behavior will insert a null value to that column and the actual value of that column will be determined by the system.

Parameters:
obj - the data bean to be inserted
Returns:
a boolean value indicating whether the insert operation is successful or not. Returning true means successful insertion.
Throws:
java.sql.SQLException
DataTransferException

create

public boolean create(java.lang.Object obj,
                      boolean ignorAutoIncrement)
               throws DataTransferException,
                      java.sql.SQLException
Insert the data bean obj as a new row to the corresponding database table.

Parameters:
obj - the data bean to be inserted
ignorAutoIncrement - if there is a auto increment column in the table then the value inserted to that column will depend on the value of this parameter. In this case, if the parameter is true, the value inserted into the auto increment column will be drawn from the corresponding property value of the data bean obj; If this parameter is false, then a null value will be inserted into that column and the actual value of that column will be determined by the system.
Returns:
a boolean value indicating whether the insert operation is successful or not. Returning true means successful insertion.
Throws:
java.sql.SQLException
DataTransferException

create

public boolean create(java.lang.Object obj,
                      java.sql.Connection con,
                      boolean ignorAutoIncrement)
               throws DataTransferException,
                      java.sql.SQLException
Insert the data bean obj as a new row to the corresponding database table. This method is the same as create(Object obj, boolean ignorAutoIncrement) except that the operation of this method is part of the transaction associated with the Connection object con passed in.

Parameters:
obj - the data bean to be inserted
con - the operation of this method is part of the transaction associated with the this Connection object.
ignorAutoIncrement - if there is a auto increment column in the table then the value inserted to that column will depend on the value of this parameter. In this case, if the parameter is true, the value inserted into the auto increment column will be drawn from the corresponding property value of the data bean obj; If this parameter is false, then a null value will be inserted into that column and the actual value of that column will be determined by the system.
Returns:
a boolean value indicating whether the insert operation is successful or not. Returning true means successful insertion.
Throws:
java.sql.SQLException
DataTransferException

create

public boolean create(java.lang.Object obj,
                      java.sql.Connection con)
               throws DataTransferException,
                      java.sql.SQLException
Insert the data bean obj as a new row to the corresponding database table. If there is an auto increment column in the table, the default behavior will insert a null value to that column and the actual value of that column will be determined by the system.

Parameters:
obj - the data bean to be inserted
con - the operation of this method is part of the transaction associated by this Connection object
Returns:
a boolean value indicating whether the insert operation is successful or not. Returning true means successful insertion.
Throws:
java.sql.SQLException
DataTransferException

find

public boolean find(java.lang.Object obj,
                    java.lang.String condition)
             throws java.sql.SQLException,
                    DataTransferException
Check whether the data bean obj exists in the corresponding table satisfied by the additional SQL condition if present.

Parameters:
obj - the data bean to be checked
condition - the SQL condition that must also be met if present when checking the existence of the data bean in the table
Returns:
the result checked
Throws:
java.sql.SQLException
{@link - DataTransferException}
DataTransferException

select

public java.util.Vector select(java.lang.String condition,
                               java.lang.String orderBy)
                        throws java.sql.SQLException,
                               DataTransferException
Select a Vector of data beans satisfied by the passed in SQL condition.

Parameters:
condition - the SQL condition of the select
orderBy - the SQL order by clause used in the selection (exclude the "order by" key words and only include the column(s) part of the clause in this parameter)
Throws:
java.sql.SQLException
{@link - DataTransferException}
DataTransferException

select

public java.util.Vector select(java.lang.String condition,
                               java.lang.String orderBy,
                               java.sql.Connection con)
                        throws java.sql.SQLException,
                               DataTransferException
Select a Vector of data beans satisfied by the passed in SQL condition. this method is the same as select(String condition, String orderBy) except that the operation of this method is part of the transaction associated with the Connection object con passed in.

Parameters:
condition - the SQL condition of the select
orderBy - the SQL order by clause used in the selection (exclude the "order by" key words and only include the column(s) part of the clause in this parameter)
con - the Connection object
Throws:
java.sql.SQLException
{@link - DataTransferException}
DataTransferException

select

public java.util.Vector select(java.lang.String tableList,
                               java.lang.String condition,
                               java.lang.String orderBy)
                        throws java.sql.SQLException,
                               DataTransferException
Select a Vector of data beans from this table that is satisfied by the passed in SQL condition. The tableList String that is passed in is only for constructing the SQL condition, and should not contain this calling bean's associated table name. No column from tables in this list will actually be selected.

Parameters:
tableList - a string of table names separated by a comma. The tables in the list will only be referenced from the SQL condition and should not contain this table's name. No column from tables in this list will actually be selected.
condition - the SQL condition of the select
orderBy - the SQL order by clause used in the selection (exclude the "order by" key words and only include the column(s) part of the clause in this parameter)
Throws:
java.sql.SQLException
{@link - DataTransferException}
DataTransferException

select

public java.util.Vector select(java.lang.String tableList,
                               java.lang.String condition,
                               java.lang.String orderBy,
                               java.sql.Connection con)
                        throws java.sql.SQLException,
                               DataTransferException
Select a Vector of data beans from this table that is satisfied by the passed in SQL condition. The tableList String that is passed in is only for constructing the SQL condition, and should not contain this calling bean's associated table name. No column from tables in this list will actually be selected.

Parameters:
tableList - a string of table names separated by a comma. The tables in the list will only be referenced from the SQL condition and should not contain this table's name. No column from tables in this list will actually be selected.
condition - the SQL condition of the select
orderBy - the SQL order by clause used in the selection (exclude the "order by" key words and only include the column(s) part of the clause in this parameter)
con - the operation of this method is part of the transaction associated with this Connection object
Throws:
java.sql.SQLException
{@link - DataTransferException}
DataTransferException

select

public static java.util.Vector select(java.lang.String tableList,
                                      java.lang.String columnList,
                                      java.lang.String condition,
                                      java.lang.String orderBy)
                               throws java.sql.SQLException,
                                      DataTransferException
A static method to select a vector of SimpleBean objects.

Parameters:
tableList - a string of table names list to be selected from
columnList - a string of column names list to be selected
condition - the SQL condition of the select
orderBy - the SQL order by clause used in the selection (exclude the "order by" key words and only include the column(s) part of the clause in this parameter)
Returns:
a Vector of SimpleBean objects selected
Throws:
java.sql.SQLException
{@link - DataTransferException}
DataTransferException

select

public static java.util.Vector select(java.lang.String tableList,
                                      java.lang.String columnList,
                                      java.lang.String condition,
                                      java.lang.String orderBy,
                                      java.sql.Connection con)
                               throws java.sql.SQLException,
                                      DataTransferException
A static method to select a vector of SimpleBean objects.

Parameters:
tableList - a string of table names list to be selected from
columnList - a string of column names list to be selected
condition - the SQL condition of the select
orderBy - the SQL order by clause used in the selection (exclude the "order by" key words and only include the column(s) part of the clause in this parameter)
con - the operation of this method is part of the transaction associated with this Connection object
Returns:
a Vector of SimpleBean objects selected
Throws:
java.sql.SQLException
{@link - DataTransferException}
DataTransferException

update

public int update(java.lang.Object obj,
                  java.util.Vector columnNames,
                  java.lang.String condition)
           throws DataTransferException,
                  java.sql.SQLException
Update one or more data beans' value in the table with value drawn from the passed in data bean obj. The data beans that will be affected by this method call are determined by the passed in SQL condition.

Parameters:
obj - the data bean whose properties value will be used to set the values of other beans. This bean must have this table as its associated table.
columnNames - a vector representation of the columns to be updated
condition - the SQL condition used in the update
Returns:
the number of data beans affected by the call of this method
Throws:
java.sql.SQLException
DataTransferException - if update columns are mismatched with declared fields in obj.

update

public int update(java.lang.Object obj,
                  java.util.Vector columnNames,
                  java.lang.String condition,
                  java.sql.Connection con)
           throws DataTransferException,
                  java.sql.SQLException
Update one or more data beans' value in the table with value drawn from the passed in data bean obj. The data beans that will be affected by this method call are determined by the passed in SQL condition.

Parameters:
obj - the data bean whose properties value will be used to set the values of other beans. This bean must have the same type as the calling bean of this method does.
columnNames - a vector representation of the columns to be updated
condition - the SQL condition used in the update
con - the operation of this method is part of the transaction associated with this Connection object
Returns:
the number of data beans affected by the call of this method
Throws:
java.sql.SQLException
DataTransferException - if the update columns are mismatched.

getMaxID

public java.lang.Object getMaxID(java.lang.String indexColumnName,
                                 java.sql.Connection con)
                          throws java.sql.SQLException
Get the max value of the indexColumnName column. This method is usually used within a transaction.

Parameters:
indexColumnName - column name whose max value is fetched. This column must have a type so that the SQL operation "select max(thiscolumn) from ...." is legal.
con - The operation of this method is part of the transaction associated with this Connection object.
Returns:
the result of the select
Throws:
java.sql.SQLException

getMaxPrimaryKey

public java.lang.Object getMaxPrimaryKey(java.sql.Connection con)
                                  throws java.sql.SQLException
Get the max value of the primary key column, if there is a primary key for this table. If there is no primary key exists, a RuntimeException will then be thrown. This method is usually used within a transaction.

Parameters:
con - The operation of this method is part of the transaction associated with this Connection object.
Returns:
the result of the select
Throws:
java.sql.SQLException
java.lang.RuntimeException - if the table doesn't have a primary key.

exists

public boolean exists(java.lang.Object obj)
               throws DataTransferException,
                      java.sql.SQLException
check if the data bean obj exists in the table.

Parameters:
obj - the data bean whose existence in the table that will be checked
Returns:
the result of the check
Throws:
java.sql.SQLException
DataTransferException

iterator

public java.util.Iterator iterator(java.lang.String tables,
                                   java.lang.String condition)
returns a bean Iterator. This method can be used to iterate through all the data beans in the calling bean's associated table that satisfies the passed in SQL condition. The table names in the passed in tableList parameter will only be referenced from the SQL condition and should not contain the calling bean's associated table name.

Parameters:
condition - the SQL condition for the select

iterator

public java.util.Iterator iterator(java.lang.String condition)
returns a bean Iterator. This method can be used to iterate through all the data beans in the table that satisfies the passed in SQL condition.

Parameters:
condition - the SQL condition for the select

iterator

public java.util.Iterator iterator()
returns a bean Iterator. This method can be used to iterate through all the data beans in the table.