我有一个抽象类,我的所有持久对象都从该类扩展,见下文。最初保存对象时会填充 creationDate 和 modifiedDate 字段,我可以在表中看到日期。我遇到的问题是当我更新同一个对象时,creationDate 和 modifiedDate 也都更新了,我想要的只是要更新的 modifiedDate 字段。
我正在使用带有 ebean 的 play 2.1。
抽象类...
@MappedSuperclass
public abstract class BasePersistableEntity extends Model  {
    @Temporal(TemporalType.TIMESTAMP)
    @Formats.DateTime(pattern="yyyy-MM-dd HH:mm:ss")
    @CreatedTimestamp
    protected Date creationDate;
    @Temporal(TemporalType.TIMESTAMP)
    @Formats.DateTime(pattern="yyyy-MM-dd HH:mm:ss")
    @UpdatedTimestamp
    @Version
    protected Date modifiedDate;
    public Date getCreationDate(){
        return creationDate;
    }
    public void setCreationDate(Date date){
        creationDate = date;
    }
    public Date getModifiedDate(){
        return modifiedDate;
    }
    public void setModifiedDate(Date date){
        modifiedDate = date;
    }
}
谢谢。