@WhenCreated

A date time property managed by Ebean that is set on insert only.

Typically we use both @WhenCreated and @WhenModified on a mapped superclass.

 

Example

@WhenCreated
private Instant whenCreated;

@WhenModified
private Instant whenModified;

}

 

Example on mapped superclass

@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;
    }
}