Class PutRequest
NoSQLHandle.put(oracle.nosql.driver.ops.PutRequest) operation.
 This request can be used to perform unconditional and conditional puts:
 - Overwrite any existing row. This is the default.
- Succeed only if the row does not exist. Use PutRequest.Option.IfAbsentfor this case.
- Succeed only if the row exists. Use PutRequest.Option.IfPresentfor this case
- Succeed only if the row exists and its Versionmatches a specificVersion. UsePutRequest.Option.IfVersionfor this case andsetMatchVersion(oracle.nosql.driver.Version)to specify the version to match
 Information about the existing row can be returned on failure of a put
 operation using PutRequest.Option.IfVersion or PutRequest.Option.IfAbsent by
 using setReturnRow(boolean). Requesting this information incurs
 additional cost and may affect operation latency.
 
 On a successful operation the Version returned
 by PutResult.getVersion() is non-null. Additional information,
 such as previous row information, may be available in PutResult.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumSpecifies a condition for the put operation.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanReturns whether or not the value must be an exact match to the table schema or not.intGets the number of generated identity values that are requested from the server during a put if set in this request.Returns theVersionused for a match on a conditional put.Returns the option specified for the put.booleanReturns whether information about the exist row should be returned on failure because of a version mismatch or failure of an "if absent" operation.intReturns the timeout to use for the operation, in milliseconds.getTTL()Returns theTimeToLivevalue, if set.Returns the type name of the request.booleanReturns whether or not to update the row's time to live (TTL) based on a table default value if the row exists.getValue()Returns the value of the row to be used.setCompartment(String compartment) Cloud service only.setDurability(Durability durability) Sets the durability to use for the operation.setExactMatch(boolean value) If true the value must be an exact match for the table schema or the operation will fail.setIdentityCacheSize(int size) Sets the number of generated identity values that are requested from the server during a put.setMatchVersion(Version version) Sets theVersionto use for a conditional put operation.setNamespace(String namespace) Sets the optional namespace.setOption(PutRequest.Option option) Sets the option for the put.setReturnRow(boolean value) Sets whether information about the exist row should be returned on failure because of a version mismatch or failure of an "if absent" operation.setTableName(String tableName) Sets the table name to use for the operationsetTimeout(int timeoutMs) Sets the request timeout value, in milliseconds.setTTL(TimeToLive ttl) Sets theTimeToLivevalue, causing the time to live on the row to be set to the specified value on put.setUseTableDefaultTTL(boolean value) If true, and there is an existing row, causes the operation to update the time to live (TTL) value of the row based on the Table's default TTL if set.Sets the value to use for the put operation.setValueFromJson(String jsonValue, JsonOptions options) Sets the value to use for the put operation based on a JSON string.Methods inherited from class oracle.nosql.driver.ops.DurableRequestgetDurabilityMethods inherited from class oracle.nosql.driver.ops.RequestgetCompartment, getNamespace, getRateLimitDelayedMs, getReadRateLimiter, getRetryStats, getTableName, getWriteRateLimiter, setReadRateLimiter, setWriteRateLimiter
- 
Constructor Details- 
PutRequestpublic PutRequest()Constructs an empty request
 
- 
- 
Method Details- 
setCompartmentCloud service only.Sets the name or id of a compartment to be used for this operation. The compartment may be specified as either a name (or path for nested compartments) or as an id (OCID). A name (vs id) can only be used when authenticated using a specific user identity. It is not available if authenticated as an Instance Principal which can be done when calling the service from a compute instance in the Oracle Cloud Infrastructure. See SignatureProvider.createWithInstancePrincipal()- Parameters:
- compartment- the name or id. If using a nested compartment, specify the full compartment path- compartmentA.compartmentB, but exclude the name of the root compartment (tenant).
- Returns:
- this
 
- 
getValueReturns the value of the row to be used.- Returns:
- the value, or null if not set
 
- 
setValueSets the value to use for the put operation. This is a required parameter and must be set using this method orsetValueFromJson(java.lang.String, oracle.nosql.driver.values.JsonOptions).- Parameters:
- value- the row value
- Returns:
- this
 
- 
setValueFromJsonSets the value to use for the put operation based on a JSON string. The string is parsed for validity and stored internally as aMapValue. This is a required parameter and must be set using this method orsetValue(oracle.nosql.driver.values.MapValue).- Parameters:
- jsonValue- the row value as a JSON string
- options- optional configuration to specify how to map JSON data
- Returns:
- this
 
- 
getTTLReturns theTimeToLivevalue, if set.- Returns:
- the TimeToLiveif set, null otherwise.
 
- 
setTTLSets theTimeToLivevalue, causing the time to live on the row to be set to the specified value on put. This value overrides any default time to live setting on the table.- Parameters:
- ttl- the time to live
- Returns:
- this
 
- 
setUseTableDefaultTTLIf true, and there is an existing row, causes the operation to update the time to live (TTL) value of the row based on the Table's default TTL if set. If the table has no default TTL this state has no effect. By default updating an existing row has no effect on its TTL.- Parameters:
- value- true or false
- Returns:
- this
 
- 
getUseTableDefaultTTLpublic boolean getUseTableDefaultTTL()Returns whether or not to update the row's time to live (TTL) based on a table default value if the row exists. By default updates of existing rows do not affect that row's TTL.- Returns:
- the value
 
- 
getMatchVersionReturns theVersionused for a match on a conditional put.- Returns:
- the Version or null if not set
 
- 
setMatchVersionSets theVersionto use for a conditional put operation. The Version is usually obtained fromGetResult.getVersion()or other method that returns a Version. When set, the put operation will succeed only if the row exists and its Version matches the one specified. This condition exists to allow an application to ensure that it is updating a row in an atomic read-modify-write cycle. Using this mechanism incurs additional cost.- Parameters:
- version- the Version to match
- Returns:
- this
 
- 
getOptionReturns the option specified for the put.- Returns:
- the option specified.
 
- 
setOptionSets the option for the put.- Parameters:
- option- the option to set.
- Returns:
- this
 
- 
getTimeoutpublic int getTimeout()Returns the timeout to use for the operation, in milliseconds. A value of 0 indicates that the timeout has not been set.- Returns:
- the value
 
- 
getReturnRowpublic boolean getReturnRow()Returns whether information about the exist row should be returned on failure because of a version mismatch or failure of an "if absent" operation. If no option is set viasetOption(oracle.nosql.driver.ops.PutRequest.Option)or the option isPutRequest.Option.IfPresentthe value of this parameter is ignored and there will not be any return information.- Returns:
- true if information should be returned.
 
- 
setTableNameSets the table name to use for the operation- Parameters:
- tableName- the table name
- Returns:
- this
 
- 
setReturnRowSets whether information about the exist row should be returned on failure because of a version mismatch or failure of an "if absent" operation.- Parameters:
- value- set to true if information should be returned
- Returns:
- this
 
- 
setDurabilitySets the durability to use for the operation. On-premises only.- Parameters:
- durability- the durability value. Set to null for the default durability setting on the server.
- Returns:
- this
- Since:
- 5.3.0
 
- 
setTimeoutSets the request timeout value, in milliseconds. This overrides any default value set in withNoSQLHandleConfig.setRequestTimeout(int). The value must be positive.- Parameters:
- timeoutMs- the timeout value, in milliseconds
- Returns:
- this
- Throws:
- IllegalArgumentException- if the timeout value is less than or equal to 0
 
- 
setNamespaceSets the optional namespace. On-premises only. This overrides any default value set withNoSQLHandleConfig.setDefaultNamespace(java.lang.String). Note: if a namespace is specified in the table name for the request (using the namespace:tablename format), that value will override this setting.- Parameters:
- namespace- the namespace to use for the operation
- Returns:
- this
- Since:
- 5.4.10
 
- 
setExactMatchIf true the value must be an exact match for the table schema or the operation will fail. An exact match means that there are no required fields missing and that there are no extra, unknown fields. The default behavior is to not require an exact match.- Parameters:
- value- true or false
- Returns:
- this
- Since:
- 5.0.1
 
- 
getExactMatchpublic boolean getExactMatch()Returns whether or not the value must be an exact match to the table schema or not.- Returns:
- the value
- Since:
- 5.0.1
 
- 
setIdentityCacheSizeSets the number of generated identity values that are requested from the server during a put. This takes precedence over the DDL identity CACHE option set during creation of the identity column. Any value equal or less than 0 means that the DDL identity CACHE value is used.- Parameters:
- size- the size
- Returns:
- this
- Since:
- 5.0.1
 
- 
getIdentityCacheSizepublic int getIdentityCacheSize()Gets the number of generated identity values that are requested from the server during a put if set in this request.- Returns:
- the value, or 0 if it has not been set.
- Since:
- 5.0.1
 
- 
getTypeNameDescription copied from class:RequestReturns the type name of the request. This is used for stats.- Specified by:
- getTypeNamein class- Request
- Returns:
- the type name of the request
 
 
-