Class UpdateRequest.UpdateMappingConsumer

java.lang.Object
org.datanucleus.store.rdbms.request.UpdateRequest.UpdateMappingConsumer
All Implemented Interfaces:
MappingConsumer
Enclosing class:
UpdateRequest

private class UpdateRequest.UpdateMappingConsumer extends Object implements MappingConsumer
Mapping Consumer used for generating the UPDATE statement for an object in a table. This statement will be of the form
 UPDATE table-name SET param1=?,param2=? 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 Details

    • initialized

      boolean initialized
      Flag for initialisation state of the consumer.
    • paramIndex

      int paramIndex
      Current parameter index.
    • updateFields

      List updateFields
      Numbers of all fields to be updated.
    • whereFields

      List whereFields
      Numbers of all WHERE clause fields.
    • postSetMappings

      List<JavaTypeMapping> postSetMappings
      Mappings that require post-set processing.
    • callbackMappings

      List<MappingCallbacks> callbackMappings
      Mappings that require callbacks calling.
    • columnAssignments

      StringBuilder columnAssignments
      for UPDATE statement
    • assignedColumns

      Map assignedColumns
    • where

      Where clause for the statement. Built during the consumption process.
    • cmd

      private final org.datanucleus.metadata.AbstractClassMetaData cmd
      MetaData for the class of the object
    • whereClauseConsumption

      private boolean whereClauseConsumption
    • updateUserStatementMapping

      private StatementMappingIndex updateUserStatementMapping
    • updateTimestampStatementMapping

      private StatementMappingIndex updateTimestampStatementMapping
  • Constructor Details

    • UpdateMappingConsumer

      public UpdateMappingConsumer(org.datanucleus.metadata.AbstractClassMetaData cmd)
      Constructor
      Parameters:
      cmd - metadata for the class
  • Method Details

    • setWhereClauseConsumption

      public void setWhereClauseConsumption(boolean whereClause)
    • preConsumeMapping

      public void preConsumeMapping(int highest)
      Description copied from interface: MappingConsumer
      This method is called before consuming the mappings
      Specified by:
      preConsumeMapping in interface MappingConsumer
      Parameters:
      highest - the highest number for the fields that are going to be provided in the consumer
    • consumeMapping

      public void consumeMapping(JavaTypeMapping m, org.datanucleus.metadata.AbstractMemberMetaData mmd)
      Consumes a mapping for a field.
      Specified by:
      consumeMapping in interface MappingConsumer
      Parameters:
      m - The mapping.
      mmd - MetaData for the field
    • consumeMapping

      public void consumeMapping(JavaTypeMapping m, MappingType mappingType)
      Consumes a mapping associated to surrogate / special columns.
      Specified by:
      consumeMapping in interface MappingConsumer
      Parameters:
      m - The mapping.
      mappingType - the Mapping type
    • consumeUnmappedColumn

      public void consumeUnmappedColumn(Column col)
      Consumer a column without mapping.
      Specified by:
      consumeUnmappedColumn in interface MappingConsumer
      Parameters:
      col - Column
    • getUpdateUserStatementMapping

      public StatementMappingIndex getUpdateUserStatementMapping()
    • getUpdateTimestampStatementMapping

      public StatementMappingIndex getUpdateTimestampStatementMapping()
    • getPostSetMappings

      public List<JavaTypeMapping> getPostSetMappings()
    • getMappingCallbacks

      public List<MappingCallbacks> getMappingCallbacks()
    • getUpdateFieldNumbers

      public int[] getUpdateFieldNumbers()
      Accessor for the numbers of fields to be updated (excluding PK fields).
      Returns:
      array of absolute field numbers
    • getWhereFieldNumbers

      public int[] getWhereFieldNumbers()
      Accessor for the numbers of fields in the WHERE clause.
      Returns:
      array of absolute WHERE clause field numbers
    • getStatement

      public String getStatement()
      Accessor for the basic update SQL statement.
       UPDATE TABLE SET COL1 = ?, COL2 = ? WHERE COL3 = ? AND COL4 = ? 
       
      Returns:
      The update SQL statement