When it comes to performance: What is the better way to validate the user input?
If you think about a phone number and you only want numbers in the database, but it could begin with a 0, so you will use varchar:
Is it better to check it via the entity model like this:
@Size(min = 10, max = 12) @Digits(fraction = 0, integer = 12) @Column(name = "phone_number") private String phoneNumber;
Or is it better to use on the database side a CHECK (and no checking in the entity model) for the same feature?