home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
Cafe
/
ddetour.bin
/
DBA_registrationRecord.java
< prev
next >
Wrap
Text File
|
1998-03-19
|
4KB
|
135 lines
import symantec.itools.db.beans.jdbc.*;
import symantec.itools.db.beans.binding.*;
import java.util.*;
import java.sql.*;
public class DBA_registrationRecord extends RecordDefinition
{
public static Statement m_InsertStatement=null;
public Statement m_UpdateStatement=null;
public Statement m_DeleteStatement=null;
static DataModel m_DataModel = null;
private static int counter = 0;
public DBA_registrationRecord()
{
synchronized (this) {
if (counter == 0) {
init();
}
counter++;
}
}
public void init()
{
//{{INIT_CONTROLS
setConnectionManagerClassName("ConnectionManager1");
setConnectionName("jdbcConnection1");
setTableName("DBA.registration");
addColumn("Package_ID");
addColumn("Customer_First_Name");
addColumn("Customer_Last_Name");
addColumn("Customer_Email");
addColumn("Customer_Phone");
addColumn("Number_in_Party");
addColumn("Total_Cost");
addColumn("Registration_ID");
//}}
}
public synchronized void setDataModel(PersistentObjectModel model)
{
m_DataModel = (DataModel)model;
}
// getDataModel
// Returns the data model for this class.
// If the data model has not been generated call generateDataModel
// generateDataModel executes a query and builds the data model from the result
// If you want to customize the data model create it here instead of calling generate data model
public synchronized PersistentObjectModel getDataModel()
{
if (m_DataModel == null) {
try {
m_DataModel = generateDataModel();
}
catch (Exception ex) {
throw new RuntimeException(ex.getMessage());
}
}
return m_DataModel;
}
// getInsertStatement
// Returns a Statement object used to perform an INSERT operation.
// If you want to customize the INSERT operation write your own code in this method.
// If you bypass getStatement, you should also bypass setParameterValues,
// since the parameters must be set in accordance with the Statement.
protected synchronized Statement getInsertStatement() throws SQLException
{
PreparedStatement psmd = (PreparedStatement)m_InsertStatement;
if (psmd==null) {
psmd = getStatement(psmd,INSERT_SQL);
}
setParameterValues(psmd);
return psmd;
}
// getUpdateStatement
// Returns a Statement object used to perform an UPDATE operation.
// If you want to customize the UPDATE operation write your own code in this method.
// If you bypass getStatement, you should also bypass setParameterValues,
// since the parameters must be set in accordance with the Statement.
protected synchronized Statement getUpdateStatement() throws SQLException
{
PreparedStatement psmd=(PreparedStatement)m_UpdateStatement;
psmd = getStatement(psmd,UPDATE_SQL);
setParameterValues(psmd);
setParameters(psmd,ORIGINAL_VALUE,getColModif(),false);
return psmd;
}
// getDeleteStatement
// Returns a Statement object used to perform an DELETE operation.
// If you want to customize the DELETE operation write your own code in this method.
// If you bypass getStatement, you should also bypass setParameterValues,
// since the parameters must be set in accordance with the Statement.
protected synchronized Statement getDeleteStatement() throws SQLException
{
PreparedStatement psmd=(PreparedStatement)m_DeleteStatement;
if (psmd==null) {
psmd = getStatement(psmd,DELETE_SQL);
}
setParameters(psmd,ORIGINAL_VALUE,0,false);
return psmd;
}
// save
// This is the top level method for performing a save.
// If you want to customize DML you should write code in one of the above methods.
// You should modify the code of this method if you want to add additional functionality.
// For instance you may want to fire an event which indicates success or failure.
public synchronized int save()
{
return super.save();
}
protected synchronized void finalize() throws Throwable
{
counter--;
if (counter == 0) {
releaseConnection();
}
}
//{{DECLARE_CONTROLS
//}}
}