Package io.datarouter.storage.config
Enum Class PutMethod
- All Implemented Interfaces:
Serializable,Comparable<PutMethod>,Constable
Defines the strategy used when writing a databean to a datastore, especially the behavior when trying to put a
databean which has a key that already exists.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionTry to insert the databean and ignore any error that may come up.Try to insert, or update all the non-key fields if the key already exists.Try to insert the databean, and throw an exception if the primary key already exists.Try to insert, and in case of failure, issue an update.Get the primary key first to determine whether to update or insert.Try to update the databean and ignore any error that may come up, like if the primary key does not exist.Try to update the row at this primary key, and throw an exception if the primary key does not exist.Try to update, and in case of failure, issue an insert. -
Field Summary
Fields -
Method Summary
-
Enum Constant Details
-
SELECT_FIRST_OR_LOOK_AT_PRIMARY_KEY
Get the primary key first to determine whether to update or insert. Slow, and may not be thread safe. -
UPDATE_OR_INSERT
Try to update, and in case of failure, issue an insert. Good to use when rows are usually there. -
INSERT_OR_UPDATE
Try to insert, and in case of failure, issue an update. -
INSERT_OR_BUST
Try to insert the databean, and throw an exception if the primary key already exists. -
UPDATE_OR_BUST
Try to update the row at this primary key, and throw an exception if the primary key does not exist. -
MERGE
-
INSERT_IGNORE
Try to insert the databean and ignore any error that may come up. If the key already exists, or any other error happens, silently abort the put. -
INSERT_ON_DUPLICATE_UPDATE
Try to insert, or update all the non-key fields if the key already exists. Performs the put as a single operation if the datastore supports it. This is the default. -
UPDATE_IGNORE
Try to update the databean and ignore any error that may come up, like if the primary key does not exist.
-
-
Field Details
-
METHODS_TO_FLUSH_IMMEDIATELY
-
DEFAULT_PUT_METHOD
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getShouldAutoCommit
public boolean getShouldAutoCommit()
-