| Installing Upgrading Designing Configuring Deploying Monitoring Administering Troubleshooting Reference JBI Components | |
| Close Print View | |
| Designing: The Table |
|
Creating a Runtime Environment
Designing Business Processes in the Sun Business Process Manager
Working with TCP/IP HL7 Collaborations
Developing Sun Master Indexes (Repository)
Developing Sun Master Patient Indexes
Developing OTDs for Application Adapters
Developing OTDs for Communication Adapters
Developing OTDs for Database Adapters
Developing OTDs for Web Server Adapters
Designing with Application Adapters
Designing with Communication Adapters
Designing with Web Server Adapters
Designing with Sun JCA Adapters
Defining Constants and Variables
JDBC Adapter Database Operations (BPEL)
JDBC Adapter Database Operations (JCD)
Sybase Adapter Database Operations (BPEL)
Sybase Adapter Database Operations (JCD)
VSAM Adapter Database Operations (BPEL)
VSAM Adapter Database Operations (JCD)
SQL Server Adapter Database Operations (BPEL)
SQL Server Adapter Database Operations (JCD)
DB2 Database Operations (BPEL)
DB2 Connect Adapter Database Operations (BPEL)
DB2 Connect Adapter Database Operations (JCD)
Oracle Adapter Database Operations (BPEL)
Oracle Adapter Outbound XA Support for BPEL
Oracle Adapter Database Operations (JCD)
Long RAW for Prepared Statements and Stored Procedure support:
A table OTD represents a database table. It consists of fields and methods. Fields correspond to the columns of a table while methods are the operations that you can apply to the OTD. This allows you to perform query, update, insert, and delete SQL operations in a table.
By default, the Table OTD has UpdatableConcurrency and ScrollTypeForwardOnly. The type of result returned by the select() method can be specified using:
SetConcurrencytoUpdatable
SetConcurrencytoReadOnly
SetScrollTypetoForwardOnly
SetScrollTypetoScrollSensitive
SetScrollTypetoInsensitive
Note - The content of the input.getText() file may contain null, meaning it will not have a “where” clause or it can contain a “where” clause such as empno > 50.
For example:
package prjOracle_JCDjcdALL;
public class jcdTableSelect
{
public com.stc.codegen.logger.Logger logger;
public com.stc.codegen.alerter.Alerter alerter;
public com.stc.codegen.util.CollaborationContext collabContext;
public com.stc.codegen.util.TypeConverter typeConverter;
public void receive( com.stc.connector.appconn.file.FileTextMessage
input, dtd.otdOutputDTD1325973702.DB_Employee otdOutputDTD_DB_Employee_1,
otdOracle.OtdOracleOTD otdOracle_1, com.stc.connector.appconn.file.
FileApplication FileClient_1 )
throws Throwable
{
FileClient_1.setText( "Selectiong records from db_employee table via
Table Select........" );
FileClient_1.write();
otdOracle_1.getDb_employee().select( input.getText() );
while (otdOracle_1.getDb_employee().next()) {
otdOutputDTD_DB_Employee_1.setEmpNo( typeConverter.shortToString(
otdOracle_1.getDb_employee().getEMP_NO(), "#", false, "" ) );
otdOutputDTD_DB_Employee_1.setLastname( otdOracle_1.getDb_employee().
getLAST_NAME() );
otdOutputDTD_DB_Employee_1.setFirstname( otdOracle_1.getDb_employee().
getFIRST_NAME() );
otdOutputDTD_DB_Employee_1.setRate( otdOracle_1.getDb_employee().
getRATE().toString() );
otdOutputDTD_DB_Employee_1.setLastDate( typeConverter.dateToString(
otdOracle_1.getDb_employee().getLAST_UPDATE(), "yyyy-MM-dd hh:mm:ss", false, "" ) );
FileClient_1.setText( otdOutputDTD_DB_Employee_1.marshalToString() );
FileClient_1.write();
}
FileClient_1.setText( "Table Select Done." );
FileClient_1.write();
}
}This example inserts an employee record.
package prjOracle_JCDjcdALL;
public class jcdInsert
{
public com.stc.codegen.logger.Logger logger;
public com.stc.codegen.alerter.Alerter alerter;
public com.stc.codegen.util.CollaborationContext collabContext;
public com.stc.codegen.util.TypeConverter typeConverter;
public void receive( com.stc.connector.appconn.file.FileTextMessage input,
otdOracle.OtdOracleOTD otdOracle_1, dtd.otdInputDTD_1206505729.DB_Employee
otdInputDTD_DB_Employee_1, com.stc.connector.appconn.file.FileApplication
FileClient_1 ) throws Throwable
{
FileClient_1.setText( "Inserting records in to db_employee table......" );
FileClient_1.write();
otdInputDTD_DB_Employee_1.unmarshalFromString( input.getText() );
otdOracle_1.getDb_employee().insert();
for (int i1 = 0; i1 < otdInputDTD_DB_Employee_1.countX_sequence_A(); i1 += 1) {
otdOracle_1.getDb_employee().setEMP_NO( typeConverter.stringToShort(
otdInputDTD_DB_Employee_1.getX_sequence_A( i1 ).getEmpNo(), "#", false, 0 ) );
otdOracle_1.getDb_employee().setLAST_NAME( otdInputDTD_DB_Employee_1.
getX_sequence_A( i1 ).getLastname() );
otdOracle_1.getDb_employee().setFIRST_NAME( otdInputDTD_DB_Employee_1.
getX_sequence_A( i1 ).getFirstname() );
otdOracle_1.getDb_employee().setRATE( new java.math.BigDecimal(
otdInputDTD_DB_Employee_1.getX_sequence_A( i1 ).getRate() ) );
otdOracle_1.getDb_employee().setLAST_UPDATE( typeConverter.
stringToTimestamp( otdInputDTD_DB_Employee_1.getX_sequence_A( i1 ).getLastDate(),
"yyyy-MM-dd hh:mm:ss", false, "" ) );
otdOracle_1.getDb_employee().insertRow();
}
FileClient_1.setText( "Insert Done." );
FileClient_1.write();
}
}Note - The content of the input.getText() file may contain null, meaning it will not have a “where” clause or it can contain a “where” clause such as empno > 50.
package prjOracle_JCDjcdALL;
public class jcdUpdate
{
public com.stc.codegen.logger.Logger logger;
public com.stc.codegen.alerter.Alerter alerter;
public com.stc.codegen.util.CollaborationContext collabContext;
public com.stc.codegen.util.TypeConverter typeConverter;
public void receive( com.stc.connector.appconn.file.FileTextMessage input,
otdOracle.OtdOracleOTD otdOracle_1, com.stc.connector.appconn.file.FileApplication
FileClient_1 ) throws Throwable
{
FileClient_1.setText( "Updating the Rate and Last_update fields .. " );
FileClient_1.write();
otdOracle_1.getDb_employee().update( input.getText() );
while (otdOracle_1.getDb_employee().next()) {
otdOracle_1.getDb_employee().setLAST_NAME( "Krishna" );
otdOracle_1.getDb_employee().setFIRST_NAME( "Kishore" );
otdOracle_1.getDb_employee().updateRow();
}
FileClient_1.setText( "Update Done." );
FileClient_1.write();
}
}Note - The content of the input.getText() file may contain null, meaning it will not have a “where” clause or it can contain a “where” clause such as empno > 50.
In this example DELETE an employee.
package prjOracle_JCDjcdALL;
public class jcdDelete
{
public com.stc.codegen.logger.Logger logger;
public com.stc.codegen.alerter.Alerter alerter;
public com.stc.codegen.util.CollaborationContext collabContext;
public com.stc.codegen.util.TypeConverter typeConverter;
public void receive( com.stc.connector.appconn.file.FileTextMessage input,
otdOracle.OtdOracleOTD otdOracle_1, com.stc.connector.appconn.file.FileApplication
FileClient_1 ) throws Throwable
{
FileClient_1.setText( "Deleting record............" );
FileClient_1.write();
otdOracle_1.getDb_employee().delete( input.getText() );
FileClient_1.setText( "Delete Done." );
FileClient_1.write();
}
}