1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
package test.peer;
import com.workingdogs.village.*;
import org.apache.turbine.om.peer.*;
import org.apache.turbine.util.*;
import org.apache.turbine.util.db.*;
import org.apache.turbine.util.db.map.*;
import java.util.*;
import test.map.*;
import test.*;
/** This class was autogenerated by XMLSchemaToObjectModel on: Sun Aug 27 15:53:54 EDT 2000 */
public class IdTablePeer extends BasePeer
{
/** the mapbuilder for this class */
private static final IdTableMapBuilder mapBuilder = (IdTableMapBuilder)getMapBuilder(IdTableMapBuilder.CLASS_NAME);
/** the table name for this class */
public static final String TABLE_NAME = mapBuilder.getTable();
/** the column name for the ID_TABLE_ID id field */
public static final String ID_TABLE_ID = mapBuilder.getIdTable_IdTableId();
/** the column name for the QUANTITY id field */
public static final String QUANTITY = mapBuilder.getIdTable_Quantity();
/** the column name for the NEXT_ID id field */
public static final String NEXT_ID = mapBuilder.getIdTable_NextId();
/** the column name for the TABLE_NAME id field */
public static final String TABLE_NAME = mapBuilder.getIdTable_TableName();
/** Method to do inserts */
public static Object doInsert( Criteria criteria ) throws Exception
{
return BasePeer.doInsert( criteria );
}
/** Method to do selects */
public static Vector doSelect( Criteria criteria ) throws Exception
{
criteria.addSelectColumn( ID_TABLE_ID );
criteria.addSelectColumn( QUANTITY );
criteria.addSelectColumn( NEXT_ID );
criteria.addSelectColumn( TABLE_NAME );
// BasePeer returns a Vector of Value (Village) arrays. The array
// order follows the order columns were placed in the Select clause.
Vector rows = BasePeer.doSelect(criteria);
Vector results = new Vector();
// populate the object(s)
for ( int i=0; i<rows.size(); i++ )
{
IdTable obj = new IdTable();
Record row = (Record)rows.elementAt(i);
obj.setIdTableId( row.getValue(1).asInt() );
obj.setQuantity( row.getValue(2).asInt() );
obj.setNextId( row.getValue(3).asInt() );
obj.setTableName( row.getValue(4).asString() );
results.addElement( obj );
}
return results;
}
/**
* @param Criteria object containing data that is used to create the UPDATE statement.
*/
public static void doUpdate(Criteria criteria) throws Exception
{
Criteria selectCriteria = new Criteria(2);
selectCriteria.put( ID_TABLE_ID, criteria.remove(ID_TABLE_ID) );
BasePeer.doUpdate( selectCriteria, criteria );
}
/**
* @param Criteria object containing data that is used DELETE from database.
*/
public static void doDelete(Criteria criteria) throws Exception
{
BasePeer.doDelete ( criteria );
}
/** Method to do inserts */
public static Object doInsert( IdTable obj ) throws Exception
{
return IdTablePeer.doInsert(buildCriteria(obj));
}
/** Build a Criteria object from the data object for this peer */
public static Criteria buildCriteria( IdTable obj )
{
Criteria criteria = new Criteria();
if( obj.getIdTableId() > 0 )
criteria.add( IdTablePeer.ID_TABLE_ID, obj.getIdTableId() );
criteria.add( IdTablePeer.QUANTITY, obj.getQuantity() );
criteria.add( IdTablePeer.NEXT_ID, obj.getNextId() );
criteria.add( IdTablePeer.TABLE_NAME, obj.getTableName() );
return criteria;
}
/**
* @param obj the data object to update in the database.
*/
public static void doUpdate(IdTable obj) throws Exception
{
IdTablePeer.doUpdate(buildCriteria(obj));
}
/**
* @param obj the data object to delete in the database.
*/
public static void doDelete(IdTable obj) throws Exception
{
IdTablePeer.doDelete(buildCriteria(obj));
}
}
|