24.2.20. @DynamicUpdate
The @DynamicUpdate
annotation is used to specify that the UPDATE
SQL statement should be generated whenever an entity is modified.
</div>
By default, Hibernate uses a cached UPDATE
statement that sets all table columns.
When the entity is annotated with the @DynamicUpdate
annotation, the PreparedStatement
is going to include only the columns whose values have been changed.
</div>
See the OptimisticLockType.DIRTY
mapping section for more info on how @DynamicUpdate
works.
</div>
</td>
For reattachment of detached entities, the dynamic update is not possible without having the @SelectBeforeUpdate
annotation as well.
</div> </td> </tr> </table> </div> </div>