Persist Creation and Update Timestamps With Hibernate
Persist Creation and Update Timestamps With Hibernate
www.thoughts-on-java.org
Persist creation and update timestamps
Example
As you can see in the following code snippet, I just added the
@CreationTimestamp annotation to the createDateTime attribute
and the @UpdateTimestamp annotation to the updateDateTime
attribute.
@Entity
public class MyEntity {
@Column
@CreationTimestamp
private LocalDateTime createDateTime;
@Column
@UpdateTimestamp
private LocalDateTime updateDateTime;
…
}
www.thoughts-on-java.org