このパターンは、OpenJPA を使用してデータベースからデータを取得する場合に使用されます。
プロパティー | 値 |
---|---|
PATTERN_IMPL_CLASS | JPAReaderPattern インターフェースを実装するクラス |
openjpa.ConnectionDriverName | JDBC ドライバー。例えば、org.apache.derby.jdbc.EmbeddedDriver です。 |
openjpa.ConnectionURL | JDBC URL。例) jdbc:derby:C:¥¥mysample CREDITREPORT |
openjpa.jdbc.SynchronizeMappings | JPA 固有プロパティー。例) buildSchema |
openjpa.ConnectionUserName | データベースのユーザー ID。例) Myid |
openjpa.ConnectionPassword | ユーザー・パスワード。例) mypwd. |
PERSISTENT_UNIT | OpenJPA パーシスタント・ユニット名。 |
プロパティー名 | 値 | 説明 |
---|---|---|
debug |
true または false (デフォルトは false) |
このバッチ・データ・ストリームに対する詳細トレースを使用可能にします。 |
openjpa.Log |
DefaultLevel=WARN,SQL=TRACE |
JPA ログ設定 |
EnablePerformanceMeasurement |
true または false (デフォルトは false) |
GenericXDBatchStep を使用している場合に、バッチ・データ・ストリームおよび processRecord メソッドにかかった合計時間を計算します。 |
EnableDetailedPerformanceMeasurement |
true または false (デフォルトは false) |
バッチ・データ・ストリームの各メソッドにかかった時間の詳細を提供します。 |
public interface JPAReaderPattern { /** * This method is invoked during the job setup phase. * * @param props properties provided in the xJCL */ public void initialize(Properties props); /** * This method should retrieve values for the various columns for the current row from the given Iterator object. * Typically this data would be used to populate an intermediate object which would be returned * @param listIt * @return */ public Object fetchRecord(Iterator listIt); /** * This method should return a JPQL query that will be used during setup of the stream to retrieve all relevant * data that would be processed part of the job steps * @return object to be used during process step. */ public String getInitialLookupQuery(); /** * This method gets called during Job Restart. The restart token should be used to create an JPQL query that will * retrieve previously unprocessed records. * Typically the restart token would be the primary key in the table and the query would get all rows with * primary key value > restarttoken * @param restartToken * @return The restart query */ public String getRestartQuery(String restartToken); /** * This method gets called just before a checkpoint is taken. * @return The method should return a string value identifying the last record read by the stream. */ public String getRestartTokens(); }
<batch-data-streams> <bds> <logical-name>inputStream</logical-name> <props> <prop name="openjpa.ConnectionDriverName" value="org.apache.derby.jdbc.EmbeddedDriver"/> <prop name="openjpa.ConnectionURL" value="jdbc:derby:/opt/tmp/hellojpadb;create=true"/> <prop name="openjpa.ConnectionUserName" value="" /> <prop name="openjpa.ConnectionPassword" value="" /> <prop name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/> <prop name="openjpa.Log" value="DefaultLevel=WARN,SQL=TRACE"/> <prop name="PERSISTENT_UNIT" value="hellojpa"/> <prop name="debug" value="true"/> <prop name="PATTERN_IMPL_CLASS" value="com.ibm.websphere.samples.JPAOutputStream"/> </props> <impl-class>com.ibm.websphere.batch.devframework.datastreams.patterns.LocalJDBCReader</impl-class> </bds> </batch-data-streams>