I was looking at the sample code provided on their page :
@Entity
public class Task extends Model {
@Id
@Constraints.Min(10)
public Long id;
@Constraints.Required
public String name;
public boolean done;
@Formats.DateTime(pattern="dd/MM/yyyy")
public Date dueDate = new Date();
public static Finder<Long, Task> find = new Finder<Long,Task>(Task.class);
}
the @Constraints.Min(10) does not seem to be working. When I tried to develop my model with a constraints, it did not trigger the validation upon saving. sample code:
@Entity
public class Company extends Model{
private static final long serialVersionUID = 1L;
@Id
public Long id;
@Column(columnDefinition = "varchar(100)", nullable false)
@Constraints.Required
@Formats.NonEmpty
@Constraints.MinLength(10)
@Constraints.MaxLength(10)
public String name;
}
and I tried to run this code :
Company company = new Company();
company.name="";
company.save()
it will save the data into the database although the name was empty string.