Adapters DB 307 ExpertPolling
Adapters DB 307 ExpertPolling
OVERVIEW
It shows a total of four expert strategies, Shadow Table, Sysdate Logical Delete,
Oracle SCN, and No After Read. These samples generally involve hand editing
the files generated by the DBAdapter UI, especially the TopLink metadata or-
mappings.xml file. TopLink is the technology on which the DbAdapter is built. A
fifth expert polling sample has its own sample: 308-RowidPolling.
Shadow table polling is like Control table except that rows are inserted into
MoviesCtrl after they have been processed, rather than before. Hence the keys
stored in the control table indicate which rows have already been processed, not
which ones are pending to be processed. In 10.1.3 this sample was named
‘PollingPureSQLOtherTableInsert’.
Sysdate Logical Delete is just a version of Logical Delete where the read value is
not static, but a function, i.e. sysdate. Hence unprocessed records have a
timestamp which is null, and processed ones are marked with the time at which
they were picked up.
Oracle SOA Suite 11g - Sample
PROVIDED FILES
This sample contains the SOA Project that you can deploy along with the sql
scripts.
VERIFYING EXECUTION
• With adapter logging set to trace, you should see the polling SQL being
issued to the log files.
Oracle SOA Suite 11g - Sample
SHADOW TABLE
<opm:querying xsi:type="toplink:query-policy">
<opm:queries>
<opm:query name="ShadowTableSelect" xsi:type="toplink:read-all-
query">
<toplink:reference-class>ShadowTable.MoviesIn</toplink:reference-
class>
<toplink:lock-mode>none</toplink:lock-mode>
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>java.util.Vector</toplink:collection-type>
</toplink:container>
</opm:query>
</opm:queries>
</opm:querying>
• We are going to add a custom sql where clause to this query. It will then
look like this:
<opm:querying xsi:type="toplink:query-policy">
<opm:queries>
<opm:query name="ShadowTableSelect" xsi:type="toplink:read-all-
query">
Oracle SOA Suite 11g - Sample
<toplink:call xsi:type="toplink:sql-call">
<toplink:sql>SELECT TITLE, DIRECTOR, STARRING, SYNOPSIS,
GENRE, RUN_TIME, RELEASE_DATE, RATED, RATING, VIEWER_RATING,
STATUS, TOTAL_GROSS, DELETED, SEQUENCENO, LAST_UPDATED,
POLLING_STRATEGY FROM MOVIES_IN WHERE POLLING_STRATEGY =
‘ShadowTable’ AND NOT (TITLE IN (SELECT MOVIE FROM
MOVIESCTRL))</toplink:sql>
</toplink:call>
<toplink:reference-class>ShadowTable.MoviesIn</toplink:reference-
class>
<toplink:lock-mode>none</toplink:lock-mode>
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>java.util.Vector</toplink:collection-type>
</toplink:container>
</opm:query>
</opm:queries>
</opm:querying>
<toplink:delete-query xsi:type="toplink:delete-object-query">
<toplink:call xsi:type="toplink:sql-call">
<toplink:sql>INSERT INTO MOVIESCTRL (MOVIE)
VALUES (#TITLE)</toplink:sql>
</toplink:call>
</toplink:delete-query>
• Create a Delete polling service. You must always use Delete Polling
Strategy as this is the only strategy where the queries are sent unmodified
to TopLink.
• On the where clause page, add the extra condition WHERE
LAST_UPDATED IS NULL.
<toplink:delete-query xsi:type="toplink:delete-object-query">
<toplink:call xsi:type="toplink:sql-call">
<toplink:sql>UPDATE MOVIES_IN SET LAST_UPDATED = sysdate
WHERE TITLE = #TITLE</toplink:sql>
Oracle SOA Suite 11g - Sample
</toplink:call>
</toplink:delete-query>
ORACLE SCN
to
This is because the value must be a legal system change number. If the
same entry as the LastReadId sample is used, it will often be 0 or 20, which may
be illegal values. Also the initial value should be null, such that on the first
iteration all rows will be processed, but then the latest SCN will be stored.
NO AFTER READ
to:
Oracle SOA Suite 11g - Sample