DomainTemplateEntity.java
package fr.tiogars.domaintemplate.domains.domaintemplate.entities;
import java.time.Instant;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
/** Persists a DomainTemplate business object. */
@Entity
@Table(name = "domain_templates")
public class DomainTemplateEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique = true, updatable = false)
private String code;
@Column(nullable = false)
private String label;
private String description;
@Column(nullable = false, updatable = false)
private Instant createdDate;
@Column(nullable = false)
private Instant lastModifiedDate;
protected DomainTemplateEntity() {
// required by JPA
}
public DomainTemplateEntity(
String code,
String label,
String description,
Instant createdDate,
Instant lastModifiedDate) {
this.code = code;
this.label = label;
this.description = description;
this.createdDate = createdDate;
this.lastModifiedDate = lastModifiedDate;
}
public void update(String label, String description, Instant lastModifiedDate) {
this.label = label;
this.description = description;
this.lastModifiedDate = lastModifiedDate;
}
public Long getId() {
return id;
}
public String getCode() {
return code;
}
public String getLabel() {
return label;
}
public String getDescription() {
return description;
}
public Instant getCreatedDate() {
return createdDate;
}
public Instant getLastModifiedDate() {
return lastModifiedDate;
}
}