public class GenericUpsert extends Object implements IUpsert
An upsert strategy that attempts to either:
Sample Generated SQL:
Insert SQL: INSERT INTO tableName (col1, col2, col3) VALUES (?, ?, ?)
Update SQL: UPDATE tableName SET col1=?, col2=?, col3=? WHERE ID=?
Constructor and Description |
---|
GenericUpsert() |
Modifier and Type | Method and Description |
---|---|
void |
addBatch() |
void |
addExceptionProperties(DataException exception) |
GenericUpsert |
clone() |
void |
close() |
void |
executeBatch() |
void |
executeUpdate() |
String |
getInsertSql() |
PreparedStatement |
getInsertStatement() |
String |
getUpdateSql() |
PreparedStatement |
getUpdateStatement() |
boolean |
isBatchSupported() |
boolean |
isDebug()
Indicates if the generated SQL should be logged (default false).
|
boolean |
isInsertFirst()
Indicates if an insert should be attempted before and update (the default) or false if the update should be attempted first.
|
void |
prepare(JdbcUpsertWriter writer,
Record record) |
GenericUpsert |
setDebug(boolean debug)
Set to
true to log generated SQL (default false). |
GenericUpsert |
setInsertFirst(boolean insertFirst)
Indicates if this upsert strategy should attempt an insert before and update (the default).
|
void |
setValues(JdbcUpsertWriter writer,
Record record) |
public boolean isInsertFirst()
public GenericUpsert setInsertFirst(boolean insertFirst)
false
will cause an update to be attempted first followed by an insert if 0 records were affected by the update.public String getInsertSql()
public PreparedStatement getInsertStatement()
public String getUpdateSql()
public PreparedStatement getUpdateStatement()
public boolean isDebug()
public GenericUpsert setDebug(boolean debug)
true
to log generated SQL (default false).public void prepare(JdbcUpsertWriter writer, Record record) throws Throwable
public void setValues(JdbcUpsertWriter writer, Record record) throws Throwable
public void executeUpdate() throws Throwable
executeUpdate
in interface IUpsert
Throwable
public boolean isBatchSupported()
isBatchSupported
in interface IUpsert
public void addBatch() throws Throwable
public void executeBatch() throws Throwable
executeBatch
in interface IUpsert
Throwable
public GenericUpsert clone()
public void close() throws Throwable
public void addExceptionProperties(DataException exception)
addExceptionProperties
in interface IUpsert
Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.