Module org.seasar.doma.core
Package org.seasar.doma.jdbc.query
Class SqlFileUpdateQuery.EntityHandler<E>
java.lang.Object
org.seasar.doma.jdbc.query.SqlFileUpdateQuery.EntityHandler<E>
- Type Parameters:
E- the entity type
- Enclosing class:
- SqlFileUpdateQuery
A handler for entity lifecycle callbacks and optimistic locking.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected EThe entity being updated.protected final EntityType<E>The entity type.protected UpdateQueryHelper<E>The helper for update operations.protected final StringThe parameter name for the entity.protected List<EntityPropertyType<E,?>> The property types to be updated.protected final VersionPropertyType<E,?, ?> The version property type for optimistic locking. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEntityHandler(String name, E entity, EntityType<E> entityType) Constructs a new instance with the specified entity information. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanReturns whether this handler has target property types.protected voidIncrements the version property for optimistic locking.protected voidinit()Initializes the update query helper.protected voidpopulateValues(SqlContext context) Populates values in the SQL context.protected voidExecutes post-update entity lifecycle callbacks.protected voidPrepares optimistic locking for this query.protected voidPrepares the target property types for this query.protected voidExecutes pre-update entity lifecycle callbacks.
-
Field Details
-
name
The parameter name for the entity. -
entity
The entity being updated. -
entityType
The entity type. -
versionPropertyType
The version property type for optimistic locking. -
targetPropertyTypes
The property types to be updated. -
helper
The helper for update operations.
-
-
Constructor Details
-
EntityHandler
Constructs a new instance with the specified entity information.- Parameters:
name- the parameter name for the entityentity- the entity being updatedentityType- 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:
trueif this handler has target property types,falseotherwise
-
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
Populates values in the SQL context.This method uses the helper to populate values for the target properties.
- Parameters:
context- the SQL context
-