Class SqlFileUpdateQuery.EntityHandler<E>

java.lang.Object
org.seasar.doma.jdbc.query.SqlFileUpdateQuery.EntityHandler<E>
Type Parameters:
E - the entity type
Enclosing class:
SqlFileUpdateQuery

protected class SqlFileUpdateQuery.EntityHandler<E> extends Object
A handler for entity lifecycle callbacks and optimistic locking.
  • Field Details

    • name

      protected final String name
      The parameter name for the entity.
    • entity

      protected E entity
      The entity being updated.
    • entityType

      protected final EntityType<E> entityType
      The entity type.
    • versionPropertyType

      protected final VersionPropertyType<E,?,?> versionPropertyType
      The version property type for optimistic locking.
    • targetPropertyTypes

      protected List<EntityPropertyType<E,?>> targetPropertyTypes
      The property types to be updated.
    • helper

      protected UpdateQueryHelper<E> helper
      The helper for update operations.
  • Constructor Details

    • EntityHandler

      protected EntityHandler(String name, E entity, EntityType<E> entityType)
      Constructs a new instance with the specified entity information.
      Parameters:
      name - the parameter name for the entity
      entity - the entity being updated
      entityType - the entity type
  • Method Details

    • init

      protected void init()
      Initializes the update query helper.

      This method creates a helper with the current configuration and entity information.

    • preUpdate

      protected void preUpdate()
      Executes pre-update entity lifecycle callbacks.

      This method creates a pre-update context and calls the entity type's preUpdate method.

    • prepareTargetPropertyTypes

      protected void prepareTargetPropertyTypes()
      Prepares the target property types for this query.

      This method uses the helper to determine which properties should be updated.

    • hasTargetPropertyTypes

      protected boolean hasTargetPropertyTypes()
      Returns whether this handler has target property types.
      Returns:
      true if this handler has target property types, false otherwise
    • postUpdate

      protected void postUpdate()
      Executes post-update entity lifecycle callbacks.

      This method creates a post-update context and calls the entity type's postUpdate method.

    • prepareOptimisticLock

      protected void prepareOptimisticLock()
      Prepares optimistic locking for this query.

      This method sets the optimistic lock check flag based on the version property and configuration.

    • incrementVersion

      protected void incrementVersion()
      Increments the version property for optimistic locking.

      This method increments the version property if one exists and version checking is not ignored.

    • populateValues

      protected void populateValues(SqlContext context)
      Populates values in the SQL context.

      This method uses the helper to populate values for the target properties.

      Parameters:
      context - the SQL context