@WhenModified
Ebean 管理的日期时间属性,在 insert
和 update
中均设置。
通常我们在映射超类上同时使用 @WhenCreated
和 @WhenModified
。
示例
@WhenCreated
private Instant whenCreated;
@WhenModified
private Instant whenModified;
}
映射超类上的示例
@MappedSuperclass
public abstract class BaseDomain {
@Id
protected UUID id;
@Version
private long version;
@WhenCreated
private Instant whenCreated;
@WhenModified
private Instant whenModified;
public UUID getId() {
return id;
}
public long getVersion() {
return version;
}
public Instant getWhenCreated() {
return whenCreated;
}
public Instant getWhenModified() {
return whenModified;
}
}