Class AutoUpdateQuery.AutoPreUpdateContext<E>
- Type Parameters:
E- the entity type
- All Implemented Interfaces:
PreUpdateContext<E>
- Enclosing class:
- AutoUpdateQuery<ENTITY>
This class provides context information for entity pre-update hooks, including which properties are being changed and which properties should be returned.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe names of properties that are being changed in this update.Fields inherited from class org.seasar.doma.internal.jdbc.entity.AbstractEntityListenerContext
config, entityType, method, newEntity -
Constructor Summary
ConstructorsConstructorDescriptionAutoPreUpdateContext(EntityType<E> entityType, Method method, Config config, List<EntityPropertyType<E, ?>> targetPropertyTypes, ReturningProperties returningProperties) Constructs an instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns the returning properties configuration for this update operation.booleanDetermines whether the entity has been changed since it was last read from the database.booleanisPropertyChanged(String propertyName) Determines whether a specific property of the entity has been changed.Methods inherited from class org.seasar.doma.internal.jdbc.entity.AbstractPreUpdateContext
validatePropertyDefinedMethods inherited from class org.seasar.doma.internal.jdbc.entity.AbstractEntityListenerContext
getConfig, getEntityType, getMethod, getNewEntity, isPropertyDefinedInternal, setNewEntityMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.seasar.doma.jdbc.entity.PreUpdateContext
getConfig, getEntityType, getMethod, getNewEntity, setNewEntity
-
Field Details
-
changedPropertyNames
The names of properties that are being changed in this update.
-
-
Constructor Details
-
AutoPreUpdateContext
public AutoPreUpdateContext(EntityType<E> entityType, Method method, Config config, List<EntityPropertyType<E, ?>> targetPropertyTypes, ReturningProperties returningProperties) Constructs an instance.- Parameters:
entityType- the entity typemethod- the method that triggered the updateconfig- the configurationtargetPropertyTypes- the property types targeted for updatereturningProperties- the properties to be returned
-
-
Method Details
-
isEntityChanged
public boolean isEntityChanged()Determines whether the entity has been changed since it was last read from the database.This method checks if any property of the entity has been modified by comparing the current values with the original values stored in the
OriginalStatesfield.This method always returns
truewhenUpdate.sqlFile()returnstrue, as SQL file-based updates do not perform change detection.The entity is considered changed if there are any properties being updated.
- Returns:
trueif the entity has been changed,falseotherwise- See Also:
-
isPropertyChanged
Determines whether a specific property of the entity has been changed.This method checks if the specified property has been modified by comparing its current value with the original value stored in the
OriginalStatesfield.This method always returns
truewhenUpdate.sqlFile()returnstrue, as SQL file-based updates do not perform change detection.A property is considered changed if it is included in the set of properties targeted for update.
- Parameters:
propertyName- the name of the property to check- Returns:
trueif the property has been changed,falseotherwise- See Also:
-
getReturningProperties
Returns the returning properties configuration for this update operation.Returning properties specify which columns should be returned by the database after an update operation, typically used with the RETURNING clause in SQL.
- Returns:
- the returning properties configuration, never
null - See Also:
-