jeudi 26 juillet 2018

validator with generated entity persistens

I generated the entities from the table

@Entity
@Table(name = "BANK")
public class Bank {
private String bankId;
@Id
@Column(name = "BANK_ID", nullable = false, length = 5)
public String getBankId() {
    return bankId;
}

 public void setBankId(String bankId) {
    this.bankId = bankId;
}

how can i use validatior without annotation like @Size. In my case it is length = 5. I need get error when bankid bean setting more 5 symbols. I find solution here https://examples.javacodegeeks.com/enterprise-java/hibernate/hibernate-validator-example/. But i don't want write annotation for each bean, i want generated column size from the exsisting table




Aucun commentaire:

Enregistrer un commentaire