I - The generic ID type.@MappedSuperclass public abstract class TimestampedBaseEntity<I extends Comparable<I> & Serializable> extends BaseEntity<I> implements Timestamped
Mapped superclass for timestamped entity.
It extends from BaseEntity.
It specifies two timestamp columns, named "created" and "lastModified".
The Id column needs to be manually taken care of.
On pre persist, the both columns will be set to current timestamp.
On pre update, the "lastModified" column will be set to current timestamp, unless skipAdjustLastModified() is called beforehand.
ID| Constructor and Description |
|---|
TimestampedBaseEntity() |
| Modifier and Type | Method and Description |
|---|---|
Instant |
getCreated() |
Instant |
getLastModified() |
void |
onPrePersist() |
void |
onPreUpdate() |
void |
setCreated(Instant created) |
void |
setLastModified(Instant lastModified) |
void |
skipAdjustLastModified()
Invoke this method if you need to skip adjusting the "last modified" timestamp during any update event on this
instance.
|
compareTo, equals, hashCode, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetId, setIdpublic void onPrePersist()
public void onPreUpdate()
public void skipAdjustLastModified()
public void setCreated(Instant created)
setCreated in interface Timestampedpublic Instant getCreated()
getCreated in interface Timestampedpublic void setLastModified(Instant lastModified)
setLastModified in interface Timestampedpublic Instant getLastModified()
getLastModified in interface TimestampedCopyright © 2015–2020 OmniFaces. All rights reserved.