This pattern is used to write data to a database using a Java Persistence API (JPA) connection.
Property | Value |
---|---|
PATTERN_IMPL_CLASS | Class implementing JPAWriterPattern interface |
openjpa.ConnectionDriverName | The JDBC driver. For example, org.apache.derby.jdbc.EmbeddedDriver |
openjpa.ConnectionURL | The JDBC URL. For example, jdbc:derby:C:\\mysample CREDITREPORT |
openjpa.jdbc.SynchronizeMappings | JPA specific property. For example, buildSchema |
openjpa.ConnectionUserName | The user ID for the database. For example, Myid |
openjpa.ConnectionPassword | User password. For example, mypwd. |
PERSISTENT_UNIT | The OpenJPA persistent unit name. |
Property name | Value | Description |
---|---|---|
debug |
true or false (default is false) |
Enables detailed tracing on this batch data stream. |
openjpa.Log |
DefaultLevel=WARN,SQL=TRACE |
JPA log settings |
EnablePerformanceMeasurement |
true or false (default is false) |
Calculates the total time spent in the batch data-streams and the processRecord method, if you are using the GenericXDBatchStep. |
public interface JPAWriterPattern { /** * This method is invoked during create job step to allow the JPAWriter stream to * initialize. * @param props Properties passed via xJCL */ public void initialize(Properties props); /** * This method is invoked to actually persist the passed object to the database * using JPA EntityManager * @param manager * @param record */ public void writeRecord(EntityManager manager, Object record); }
<batch-data-streams> <bds> <logical-name>outputStream</logical-name> <props> <prop name="PATTERN_IMPL_CLASS" value="com.ibm.websphere.batch.samples.tests.bds.EchoWriter"/> <prop name="jdbc_url" value="jdbc:derby:C:\\mysample\\CREDITREPORT"/> <prop name="jdbc_driver" value="org.apache.derby.jdbc.EmbeddedDriver"/> <prop name="user_id" value="myuserid"/> <prop name="pswd" value="mypswd"/> <prop name="debug" value="true"/> </props> <impl-class>com.ibm.websphere.batch.devframework.datastreams.patterns.LocalJDBCWriter</impl-class> </bds> </batch-data-streams>