com.alon.spring.crud.domain.model.BaseEntity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of crud-api-base Show documentation
Show all versions of crud-api-base Show documentation
Fornece implementação básica e expansível para criação API's CRUD com Spring Boot e Spring Data JPA.
package com.alon.spring.crud.domain.model;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.time.OffsetDateTime;
@MappedSuperclass
public abstract class BaseEntity implements Serializable {
@CreationTimestamp
private OffsetDateTime creationTimestamp;
@UpdateTimestamp
private OffsetDateTime updateTimestamp;
public abstract ID getId();
public abstract void setId(ID id);
public OffsetDateTime getCreationTimestamp() {
return creationTimestamp;
}
public void setCreationTimestamp(OffsetDateTime creationTimestamp) {
this.creationTimestamp = creationTimestamp;
}
public OffsetDateTime getUpdateTimestamp() {
return updateTimestamp;
}
public void setUpdateTimestamp(OffsetDateTime updateTimestamp) {
this.updateTimestamp = updateTimestamp;
}
}