Class UpdateRequest
java.lang.Object
org.datanucleus.store.rdbms.request.Request
org.datanucleus.store.rdbms.request.UpdateRequest
Class to provide a means of update of particular fields of a particular type in an RDBMS.
Extends basic request class implementing the execute method to do a JDBC update operation.
The SQL will be of the form
UPDATE table-name SET param1=?, param2=?[, version=?] WHERE id1=? AND id2=?or (when also performing version checks)
UPDATE table-name SET param1=?, param2=?, version={newvers} WHERE id1=? AND id2=? AND version={oldvers}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classMapping Consumer used for generating the UPDATE statement for an object in a table. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.datanucleus.metadata.AbstractClassMetaDataMetaData for the class.private final List<MappingCallbacks> callback mappings will have their postUpdate method called after the updateprivate final List<JavaTypeMapping> private StatementMappingDefinitionthe index for the expression in the update sql statement.private final int[]Numbers of all fields to be updated (except PK).private final StringSQL statement for the update.private final StringSQL statement for the update when using optimistic txns.private StatementMappingIndexStatementExpressionIndex for update-timestamp.private StatementMappingIndexStatementExpressionIndex for update-user.protected booleanWhether we should make checks on optimistic version before updating.protected org.datanucleus.metadata.VersionMetaDataMetaData for the version handling.private final int[]Numbers of WHERE clause fields. -
Constructor Summary
ConstructorsConstructorDescriptionUpdateRequest(DatastoreClass table, org.datanucleus.metadata.AbstractMemberMetaData[] reqFieldMetaData, org.datanucleus.metadata.AbstractClassMetaData cmd, org.datanucleus.ClassLoaderResolver clr) Constructor, taking the table. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(org.datanucleus.state.DNStateManager sm) Method performing the update of the record in the datastore.
-
Field Details
-
updateStmt
SQL statement for the update. -
updateStmtOptimistic
SQL statement for the update when using optimistic txns. -
mappingCallbacks
callback mappings will have their postUpdate method called after the update -
postSetMappings
-
stmtMappingDefinition
the index for the expression in the update sql statement. -
updateFieldNumbers
private final int[] updateFieldNumbersNumbers of all fields to be updated (except PK). -
whereFieldNumbers
private final int[] whereFieldNumbersNumbers of WHERE clause fields. -
cmd
protected org.datanucleus.metadata.AbstractClassMetaData cmdMetaData for the class. -
versionMetaData
protected org.datanucleus.metadata.VersionMetaData versionMetaDataMetaData for the version handling. -
versionChecks
protected boolean versionChecksWhether we should make checks on optimistic version before updating. -
updateUserStmtMapping
StatementExpressionIndex for update-user. -
updateTimestampStmtMapping
StatementExpressionIndex for update-timestamp.
-
-
Constructor Details
-
UpdateRequest
public UpdateRequest(DatastoreClass table, org.datanucleus.metadata.AbstractMemberMetaData[] reqFieldMetaData, org.datanucleus.metadata.AbstractClassMetaData cmd, org.datanucleus.ClassLoaderResolver clr) Constructor, taking the table. Uses the structure of the datastore table to build a basic query.- Parameters:
table- The Class Table representing the datastore table to updatereqFieldMetaData- MetaData of the fields to updatecmd- ClassMetaData of objects being updatedclr- ClassLoader resolver
-
-
Method Details
-
execute
public void execute(org.datanucleus.state.DNStateManager sm) Method performing the update of the record in the datastore. Takes the constructed update query and populates with the specific record information.
-