Hibernate timestamp version controlled by database.

我只是一个虾纸丫 提交于 2019-12-06 03:25:01

This is not an annotation, but a field of an enum:

@org.hibernate.annotations.SourceType.DB

You need this on your field:

@Version
@org.hibernate.annotations.Source(SourceType.DB)
@org.hibernate.annotations.Generated(GenerationTime.ALWAYS)
@Column(name = "row_version") //maybe unnecessary, because this annotation
                              //is only needed, if the column name does not
                              //match hibernate's default naming strategy
                              //(or custom strategy).
@Temporal(TemporalType.TIMESTAMP)
private Date rowVersion;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!