|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.northconcepts.datapipeline.core.DataEndpoint
com.northconcepts.datapipeline.core.DataWriter
com.northconcepts.datapipeline.jdbc.JdbcWriter
public class JdbcWriter
Writes records to a database table.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.northconcepts.datapipeline.core.DataEndpoint |
|---|
DataEndpoint.State |
| Field Summary | |
|---|---|
protected Record |
currentRecord
|
| Fields inherited from class com.northconcepts.datapipeline.core.DataEndpoint |
|---|
BUFFER_SIZE, log |
| Constructor Summary | |
|---|---|
JdbcWriter(Connection connection,
String tableName)
|
|
| Method Summary | |
|---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a DataException. |
void |
close()
Indicates that this endpoint has finished reading or writing. |
boolean |
getAutoCloseConnection()
|
int |
getBatchSize()
|
void |
open()
Makes this endpoint ready for reading or writing. |
JdbcWriter |
setAutoCloseConnection(boolean closeConnection)
|
JdbcWriter |
setBatchSize(int batchSize)
Sets the number of records to chunk together in batch updates. |
JdbcWriter |
setJdbcType(String fieldName,
int jdbcType)
The given Java object will be converted to the given targetSqlType before being sent to the database. |
void |
write(Record record)
Writes the specified record to this DataWriter and increases the record-count by 1. |
protected void |
writeImpl(Record record)
Overridden by subclasses to write the specified record to this DataWriter. |
| Methods inherited from class com.northconcepts.datapipeline.core.DataWriter |
|---|
getNestedWriter, getRootWriter |
| Methods inherited from class com.northconcepts.datapipeline.core.DataEndpoint |
|---|
assertNotOpened, assertOpened, decrementRecordCount, exception, exception, exception, finalize, getDescription, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, getState, incrementRecordCount, isClosed, isOpen, isRecordCountBigInteger, resetRecordCount, setDescription, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Record currentRecord
| Constructor Detail |
|---|
public JdbcWriter(Connection connection,
String tableName)
| Method Detail |
|---|
public boolean getAutoCloseConnection()
public JdbcWriter setAutoCloseConnection(boolean closeConnection)
public int getBatchSize()
public JdbcWriter setBatchSize(int batchSize)
public JdbcWriter setJdbcType(String fieldName,
int jdbcType)
The given Java object will be converted to the given targetSqlType before being sent to the database.
Note that this method may be used to pass database-specific abstract data types.
fieldName - x - the object containing the JDBC Type parameter valuepublic DataException addExceptionProperties(DataException exception)
DataEndpointDataException. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.
addExceptionProperties in class DataWriter
public void write(Record record)
throws DataException
DataWriterDataWriter and increases the record-count by 1.
Any exception raised while writing will be converted to a DataException using DataEndpoint.exception(Throwable).
Subclasses generally do not need to override this method, instead they should implement DataWriter.writeImpl(Record).
write in class DataWriterDataException
protected void writeImpl(Record record)
throws Throwable
DataWriterDataWriter.
writeImpl in class DataWriterThrowablepublic void open()
DataEndpoint
open in class DataEndpointpublic void close()
DataEndpoint
close in class DataEndpoint
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||