Can I configure Hibernate/JPA to update an entity record when only non-timestamp fields have been modified?

旧街凉风 提交于 2019-12-01 00:46:16

Update (thanks to comment):

Since v4 of Hibernate @Entity annotation is deprecated and for allowing dynamic updates you should use @DynamicUpdate(true) (in conjunction with @SelectBeforeUpdate(true))


If you want to prevent unmodified fields to be included in UPDATE queries, add this on your entity:

@org.hibernate.annotations.Entity(dynamicUpdate=true) // update only changed fields
public class ...
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!