public class DataToDatabaseSink extends Object implements DataSink
| Constructor and Description |
|---|
DataToDatabaseSink(Platform platform,
Database model)
Creates a new sink instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBean(org.apache.commons.beanutils.DynaBean bean)
Adds a dyna bean.
|
void |
end()
Notifies the sink that all beans have been added.
|
int |
getBatchSize()
Returns the (maximum) number of beans to insert in one batch.
|
boolean |
isEnsureFkOrder()
Determines whether the sink delays the insertion of beans so that the beans referenced by it
via foreignkeys are already inserted into the database.
|
boolean |
isHaltOnErrors()
Determines whether this sink halts when an error happens during the insertion of a bean
into the database.
|
boolean |
isUseBatchMode()
Determines whether batch mode is used for inserting the beans.
|
void |
setBatchSize(int batchSize)
Sets the (maximum) number of beans to insert in one batch.
|
void |
setEnsureForeignKeyOrder(boolean ensureFkOrder)
Specifies whether the sink shall delay the insertion of beans so that the beans referenced by it
via foreignkeys are already inserted into the database.
Note that you should careful with setting haltOnErrors to false as this might
result in beans not inserted at all. |
void |
setHaltOnErrors(boolean haltOnErrors)
Specifies whether this sink halts when an error happens during the insertion of a bean
into the database.
|
void |
setUseBatchMode(boolean useBatchMode)
Specifies whether batch mode is used for inserting the beans.
|
void |
start()
Notifies the sink that beans will be added.
|
public boolean isHaltOnErrors()
true.true if the sink stops when an error occurredpublic void setHaltOnErrors(boolean haltOnErrors)
haltOnErrors - true if the sink shall stop when an error occurredpublic boolean isEnsureFkOrder()
true if beans are inserted after its foreignkey-referencespublic void setEnsureForeignKeyOrder(boolean ensureFkOrder)
haltOnErrors to false as this might
result in beans not inserted at all. The sink will then throw an appropriate exception at the end
of the insertion process (method end()).ensureFkOrder - true if beans shall be inserted after its foreignkey-referencespublic boolean isUseBatchMode()
true if batch mode is used (false per default)public void setUseBatchMode(boolean useBatchMode)
useBatchMode - true if batch mode shall be usedpublic int getBatchSize()
public void setBatchSize(int batchSize)
batchSize - The number of beanspublic void end()
throws DataSinkException
end in interface DataSinkDataSinkExceptionpublic void start()
throws DataSinkException
start in interface DataSinkDataSinkExceptionpublic void addBean(org.apache.commons.beanutils.DynaBean bean)
throws DataSinkException
addBean in interface DataSinkbean - The dyna bean to addDataSinkExceptionCopyright © 2010-2015 Pivotal Software, Inc. All rights reserved.