home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-19 | 4.2 KB | 134 lines |
- import symantec.itools.db.beans.jdbc.*;
- import symantec.itools.db.beans.binding.*;
- import java.util.*;
- import java.sql.*;
-
- public class DBA_packagesRecord 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_packagesRecord()
- {
- synchronized (this) {
- if (counter == 0) {
- init();
- }
- counter++;
- }
- }
-
- public void init()
- {
- //{{INIT_CONTROLS
- setConnectionManagerClassName("ConnectionManager1");
- setConnectionName("jdbcConnection1");
- setTableName("DBA.packages");
- addColumn("Package_ID");
- addColumn("Package_Name");
- addColumn("Start_Date");
- addColumn("Number_of_Days");
- addColumn("Price_Per_Person");
- addColumn("Image");
- addColumn("Description");
- //}}
- }
-
- 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
- //}}
- }
-