import org.javers.core.metamodel.annotation.DiffIgnore;
import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.Size;
import java.util.Set;
@NoArgsConstructor
@Getter
@Setter
@Entity
@Table(name = "project")
public class ProjectComponent extends AbstractEntity {
@Id
@Column(name = "id", nullable = false, length = 128)
private String id;
@Column(name = "project_name", nullable = false)
private String projectName;
@Column(name = "name", nullable = false, columnDefinition = "nvarchar")
@Size(max = 512, message
= "Cannot exceed 512 characters")
private String name;
}
@Size(max=512) I used this in the entity field but whenever I crossed size 512 then this thing should stop on that particular field should not persist into DB and that means should not throw an exception from DB.