public class JdbcMultiUpsertWriter extends ProxyWriter
GenericUpsert, however several other are provided: MergeUpsert, VariableFieldsUpsert, MySqlUpsert.DataEndpoint.StatelastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEYBUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZEid, log, name, TIMESTAMP_FORMAT| Constructor and Description | 
|---|
JdbcMultiUpsertWriter(DataSource dataSource,
                     int connections,
                     int maxQueuedRecordsPerConnection,
                     String tableName,
                     IUpsert upsert,
                     String... keyFieldNames)  | 
JdbcMultiUpsertWriter(DataSource dataSource,
                     int connections,
                     int maxQueuedRecordsPerConnection,
                     String tableName,
                     String... keyFieldNames)  | 
JdbcMultiUpsertWriter(JdbcConnectionFactory factory,
                     int connections,
                     int maxQueuedRecordsPerConnection,
                     String tableName,
                     IUpsert upsert,
                     String... keyFieldNames)  | 
JdbcMultiUpsertWriter(JdbcConnectionFactory factory,
                     int connections,
                     int maxQueuedRecordsPerConnection,
                     String tableName,
                     String... keyFieldNames)  | 
| Modifier and Type | Method and Description | 
|---|---|
DataException | 
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a  
DataException. | 
protected JdbcUpsertWriter | 
createJdbcUpsertWriter(Connection connection,
                      String tableName,
                      IUpsert upsertStrategy)  | 
AsyncWriter | 
getAsyncWriter(int index)  | 
int | 
getBatchSize()  | 
int | 
getConnections()  | 
DataException | 
getException()
Returns an exception thrown by one of the internal AsyncWriters if any. 
 | 
List<DataException> | 
getExceptions()
Returns all exceptions thrown by the internal AsyncWriters (the list will not be null, but may contain no elements). 
 | 
Integer | 
getJdbcType(Class<?> type)
The  
Types constant (or a database specific value) assigned to the specified Java class type using setJdbcType(Class, int) or null if none was set. | 
JdbcUpsertWriter | 
getJdbcWriter(int index)  | 
FieldList | 
getNonUpdateFields()
Returns the list of fields that must not be updated if the recored already exists (default null). 
 | 
IUpsert | 
getUpsert()  | 
boolean | 
isCommitBatch()
Indicates if this writer should call commit on each connection after every batch is sent,
 otherwise, commit is called after the final batch update (default is false). 
 | 
boolean | 
isDebug()
Indicates if the generated SQL should be logged (default false). 
 | 
void | 
open()
Makes this endpoint ready for reading or writing. 
 | 
void | 
rethrowAsyncException()
Re-throws an exception thrown by one of the internal AsyncWriters or returns silently if no exceptions were thrown. 
 | 
JdbcMultiUpsertWriter | 
setBatchSize(int batchSize)
Sets the number of records to chunk together in batch updates. 
 | 
JdbcMultiUpsertWriter | 
setCommitBatch(boolean commitBatch)
Indicates if this writer should call commit on each connection after every batch is sent,
 otherwise, commit is called after the final batch update (default is false). 
 | 
JdbcMultiUpsertWriter | 
setDebug(boolean debug)
Indicates if the generated SQL should be logged (default false). 
 | 
JdbcMultiUpsertWriter | 
setJdbcType(Class<?> type,
           int jdbcType)
Forces field values of the specified Java class type to be sent to the database using  
PreparedStatement.setObject(parameterIndex, fieldValue, jdbcType)
 (instead of the appropriate PreparedStatement.setXXX() method for its field's type). | 
JdbcMultiUpsertWriter | 
setJdbcType(String fieldName,
           int jdbcType)
 The given Java object will be converted to the given targetSqlType before being sent to the database. 
 | 
JdbcMultiUpsertWriter | 
setNonUpdateFields(FieldList nonUpdateFields)
Assigns the list of fields that must not be updated if the recored already exists (default null). 
 | 
JdbcMultiUpsertWriter | 
setNonUpdateFields(String... nonUpdateFields)
Assigns the list of fields that must not be updated if the recored already exists (default null). 
 | 
protected void | 
writeImpl(Record record)
Overridden by subclasses to write the specified record to this  
DataWriter. | 
available, close, getNestedWriter, interceptRecord, map, map, setNestedDataWriter, setNestedDataWritergetNestedEndpoint, getRootEndpoint, getRootWriter, getWriter, writedecrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toStringaddElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescriptionpublic JdbcMultiUpsertWriter(DataSource dataSource, int connections, int maxQueuedRecordsPerConnection, String tableName, IUpsert upsert, String... keyFieldNames)
public JdbcMultiUpsertWriter(DataSource dataSource, int connections, int maxQueuedRecordsPerConnection, String tableName, String... keyFieldNames)
public JdbcMultiUpsertWriter(JdbcConnectionFactory factory, int connections, int maxQueuedRecordsPerConnection, String tableName, IUpsert upsert, String... keyFieldNames) throws DataException
DataExceptionpublic JdbcMultiUpsertWriter(JdbcConnectionFactory factory, int connections, int maxQueuedRecordsPerConnection, String tableName, String... keyFieldNames) throws DataException
DataExceptionpublic int getConnections()
public JdbcUpsertWriter getJdbcWriter(int index)
public AsyncWriter getAsyncWriter(int index)
public int getBatchSize()
public JdbcMultiUpsertWriter setBatchSize(int batchSize)
public boolean isCommitBatch()
public JdbcMultiUpsertWriter setCommitBatch(boolean commitBatch)
public FieldList getNonUpdateFields()
null or a list of empty fields.public JdbcMultiUpsertWriter setNonUpdateFields(FieldList nonUpdateFields)
public JdbcMultiUpsertWriter setNonUpdateFields(String... nonUpdateFields)
public IUpsert getUpsert()
public JdbcMultiUpsertWriter 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 - jdbcType - the object containing the JDBC Type parameter valuepublic JdbcMultiUpsertWriter setJdbcType(Class<?> type, int jdbcType)
PreparedStatement.setObject(parameterIndex, fieldValue, jdbcType)
 (instead of the appropriate PreparedStatement.setXXX() method for its field's type).  This method may be used to pass database-specific abstract data types.type - the Java class type to override.jdbcType - one of the Types constants or a database specific value.public Integer getJdbcType(Class<?> type)
Types constant (or a database specific value) assigned to the specified Java class type using setJdbcType(Class, int) or null if none was set.Types constants or a database specific value.public boolean isDebug()
public JdbcMultiUpsertWriter setDebug(boolean debug)
public void open()
          throws DataException
DataEndpointopen in class ProxyWriterDataExceptionprotected JdbcUpsertWriter createJdbcUpsertWriter(Connection connection, String tableName, IUpsert upsertStrategy)
protected void writeImpl(Record record) throws Throwable
DataWriterDataWriter.writeImpl in class ProxyWriterThrowablepublic DataException getException()
public List<DataException> getExceptions()
public void rethrowAsyncException()
                           throws DataException
DataExceptionpublic DataException addExceptionProperties(DataException exception)
EndpointDataException.  Since this method is called whenever an
 exception is thrown, subclasses should override it to add their specific information.addExceptionProperties in class ProxyWriterCopyright (c) 2006-2025 North Concepts Inc. All Rights Reserved.