- java.lang.Object
-
- org.datanucleus.store.rdbms.request.Request
-
- org.datanucleus.store.rdbms.request.UpdateRequest
-
public class UpdateRequest extends Request
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 formUPDATE 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}
-
-
Field Summary
Fields Modifier and Type Field Description protected org.datanucleus.metadata.AbstractClassMetaDatacmdMetaData for the class.protected booleanversionChecksWhether we should make checks on optimistic version before updating.protected org.datanucleus.metadata.VersionMetaDataversionMetaDataMetaData for the version handling.
-
Constructor Summary
Constructors Constructor Description UpdateRequest(DatastoreClass table, org.datanucleus.metadata.AbstractMemberMetaData[] reqFieldMetaData, org.datanucleus.metadata.AbstractClassMetaData cmd, org.datanucleus.ClassLoaderResolver clr)Constructor, taking the table.UpdateRequest(DatastoreClass table, org.datanucleus.metadata.AbstractMemberMetaData[] reqFieldMetaData, org.datanucleus.metadata.AbstractClassMetaData cmd, org.datanucleus.ClassLoaderResolver clr, BitSet nullPkFields, boolean noVersionUpdate)Constructor, taking the table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(org.datanucleus.state.DNStateManager sm)Method performing the update of the record in the datastore.booleanwillUpdate()Check if update request will actually do any updates.
-
-
-
Field Detail
-
cmd
protected org.datanucleus.metadata.AbstractClassMetaData cmd
MetaData for the class.
-
versionMetaData
protected org.datanucleus.metadata.VersionMetaData versionMetaData
MetaData for the version handling.
-
versionChecks
protected boolean versionChecks
Whether we should make checks on optimistic version before updating.
-
-
Constructor Detail
-
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
-
UpdateRequest
public UpdateRequest(DatastoreClass table, org.datanucleus.metadata.AbstractMemberMetaData[] reqFieldMetaData, org.datanucleus.metadata.AbstractClassMetaData cmd, org.datanucleus.ClassLoaderResolver clr, BitSet nullPkFields, boolean noVersionUpdate)
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 resolvernullPkFields- Fields in PK that are null - only used if PC model has objects with nullable PK fieldsnoVersionUpdate- Should we ignore updating version when using optimistic lock?
-
-
Method Detail
-
willUpdate
public boolean willUpdate()
Check if update request will actually do any updates.- Returns:
- true if updates will be made, and return false if no updates will be made.
-
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.
-
-