Module org.seasar.doma.core
Package org.seasar.doma.jdbc.query
Class SqlFileBatchUpdateQuery.EntityHandler
java.lang.Object
org.seasar.doma.jdbc.query.SqlFileBatchUpdateQuery.EntityHandler
- Enclosing class:
- SqlFileBatchUpdateQuery<ELEMENT>
A handler for entity lifecycle callbacks, optimistic locking, and value population.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final EntityType<ELEMENT>The entity type.protected BatchUpdateQueryHelper<ELEMENT>The helper for batch update operations.protected List<EntityPropertyType<ELEMENT,?>> The property types to be included in the update.protected final VersionPropertyType<ELEMENT,?, ?> The version property type for optimistic locking. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEntityHandler(EntityType<ELEMENT> entityType) Constructs a new instance with the specified entity type. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidIncrements version values for optimistic locking.protected voidinit()Initializes this handler.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
-
entityType
The entity type. -
versionPropertyType
The version property type for optimistic locking. -
targetPropertyTypes
The property types to be included in the update. -
helper
The helper for batch update operations.
-
-
Constructor Details
-
EntityHandler
Constructs a new instance with the specified entity type.- Parameters:
entityType- the entity type
-
-
Method Details
-
init
protected void init()Initializes this handler.This method creates a batch update query helper with the configured properties.
-
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 retrieves the target property types from the helper.
-
postUpdate
protected void postUpdate()Executes post-update entity lifecycle callbacks.This method creates a post-update context, calls the entity type's postUpdate method, and saves the current state of the entity.
-
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.
-
incrementVersions
protected void incrementVersions()Increments version values for optimistic locking.This method increments the version property value for each entity in the batch if optimistic locking is enabled.
-
populateValues
Populates values in the SQL context.This method delegates to the helper to populate values for the current entity.
- Parameters:
context- the SQL context
-