DML Operations SQL Operations as Web Services

9-54 Oracle Fusion Middleware Users Guide for Technology Adapters ■ SelectGroupBy ■ SelectStar To obtain these files, access the Oracle SOA Sample Code site, and select the Adapters tab. Advanced Use Cases for Outbound Invoke Operations Advanced outbound invoke operations are demonstrated in the following tutorial files: ■ InsertWithClobs ■ XAInsert ■ NativeSequencingInsert To obtain these files, access the Oracle SOA Sample Code site, and select the Adapters tab.

9.4.2.2 Polling Strategies

The inbound receive enables you to listen to and detect events and changes in the database, which in turn can be the initiators of a business process. This is not a one-time action, but rather an activation. A polling thread is started, which polls a database table for new rows or events. Whenever a new row is inserted into the MOVIES table, the polling operation raises it to the SCA Run Time. The strategy is to poll every record once. The initial SELECT has to be repeated over time, to receive the rows that exist at the start and all new rows as they are inserted over time. However, a new row once read is not likely to be deleted, and therefore can possibly be read repeatedly with each polling. The various ways to poll for events, called polling strategies, also known as after-read strategies or publish strategies, range from simple and intrusive to sophisticated and nonintrusive. Each strategy employs a different solution for the problem of what to do after reading a row or event so as not to pick it up again in the next polling interval. The simplest and most intrusive solution is to delete the row so that you do not query it again. This section discusses the following polling operations that you can perform after the data is read from the database. This section also discusses the strategies and factors to help you determine which strategy to employ for a particular situation: ■ Delete the Rows that were Read ■ Update a Field in the [Table_Name] Table Logical Delete ■ Update a Sequencing Table ■ Update an External Sequencing Table on a Different Database ■ Control Table Strategy ■ Update a Sequencing File Delete the Rows that were Read Choose this operation to employ the physical delete polling strategy. This operation polls the database table for records and deletes them after processing. This strategy can be used to capture events related to INSERT operations and cannot capture database events related to DELETE and UPDATE operations on the parent table. This strategy Oracle JCA Adapter for Database 9-55 cannot be used to poll child table events. This strategy allows multiple adapter instances to go against the same source table. There is zero data replication. Preconditions: You must have deletion privileges on the parent and associated child tables to use the delete polling strategy. Table 9–7 describes the requirements for using the delete polling strategy. Configuration: You can configure the delete polling strategy to delete the top-level row, to cascade all, or to cascade on a case-by-case basis. This enables deleting only the parent rows and not the child rows, cascaded deletes, and optional cascaded deletes, determined on a case-by-case basis. You can configure the polling interval for performing an event publish at design time. Delete Cascade Policy: The optional advanced configuration is to specify the cascade policy of the DELETE operation. For instance, after polling for an employee with an address and many phone numbers, the phone numbers are deleted because they are privately owned default for one-to-many, but not the address default for one-to-one. This can be altered by configuring or_mappings.xml, as in the following example: database-mapping attribute-nameordersattribute-name reference-classtaxonomy.Orderreference-class is-private-ownedtrueis-private-owned You can also configure the activation itself to delete only the top level master row or to delete everything. A receive operation appears in an inbound JCA as follows: connection-factory location=eisDBConnection1 UIConnectionName=Connection1 adapterRef= endpoint-activation portType=dd_ptt operation=receive activation-spec className=oracle.tip.adapter.db.DBActivationSpec property name=DescriptorName value=dd.Emp Table 9–7 Delete Polling Strategy Preconditions Requirements Met Conflicts With Poll for inserts No delete on source Shallow delete No updates on source Cascading delete Poll for updates Minimal SQL Poll for deletes Zero data replication Poll for child updates Default -- Allows raw SQL -- Concurrent polling -- Note: In Shallow delete and Cascading delete, the delete operation can be configured to delete the top-level row, to cascade all, or to cascade on a case-by-case basis. Concurrent polling can be configured for both delete and logical delete polling strategies. 9-56 Oracle Fusion Middleware Users Guide for Technology Adapters property name=QueryName value=ddSelect property name=MappingsMetaDataURL value=dd-or-mappings.xml property name=PollingStrategy value=LogicalDeletePollingStrategy property name=MarkReadColumn value=STATUS property name=MarkReadValue value=PROCESSED property name=MarkReservedValue value=RESERVED-1 property name=MarkUnreadValue value=UNPROCESSED property name=PollingInterval value=5 property name=MaxRaiseSize value=1 property name=MaxTransactionSize value=10 property name=ReturnSingleResultSet value=false activation-spec endpoint-activation adapter-config Update a Field in the [Table_Name] Table Logical Delete Choose this operation to employ the logical delete polling strategy. This strategy involves updating a special field on each row processed and updating the WHERE clause at run time to filter out processed rows. It mimics logical delete, wherein applications rows are rarely deleted but instead a status column isDeleted is set to true. The status column and the read value must be provided, but the modified WHERE clause and the post-read update are handled automatically by the Oracle Database Adapter. Preconditions: You must have the logical delete privilege or a one-time alter schema add column privilege on the source table. Table 9–8 describes the requirements for using the logical delete polling strategy. Configuration: The logical delete polling strategy requires minimal configuration. You must specify the mark read column and the value that indicates a processed record. Table 9–8 Logical Delete Polling Strategy Preconditions Requirements Met Conflicts With Poll for inserts No updates on source No delete on source Poll for deletes Minimal SQL -- Zero data replication -- Minimal configuration -- Allows raw SQL -- Poll for updates -- Poll for child updates -- Concurrent polling -- Note: The requirements of the following are met, as follows: ■ Poll for updates : By adding a trigger ■ Poll for child updates : By adding a trigger ■ Concurrent polling : By specifying additional mark unread and reserved values.