@Setter
@Getter
@MappedSuperclass
public class BaseEntity implements Serializable{
private static final long serialVersionUID=1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", unique = true)
private long id;
@Column(length = 36, columnDefinition = "varchar", updatable = false, nullable = false, unique = true)
private UUID publicId= UUID.randomUUID();
@CreationTimestamp
@Column(updatable = false)
private Timestamp createdAt;
@UpdateTimestamp
private Timestamp lastModifiedAt;
public boolean isNew(){
return this.id==null;
}
}