set digit length to 10

This commit is contained in:
Arsh 2023-06-06 23:52:12 +05:30
parent 0d9e882e54
commit 87c47746b4

View file

@ -18,6 +18,7 @@ package org.springframework.samples.petclinic.owner;
import java.util.ArrayList;
import java.util.List;
import jakarta.validation.constraints.Pattern;
import org.springframework.core.style.ToStringCreator;
import org.springframework.samples.petclinic.model.Person;
import org.springframework.util.Assert;
@ -57,6 +58,7 @@ public class Owner extends Person {
@Column(name = "telephone")
@NotEmpty
@Digits(fraction = 0, integer = 10)
@Pattern(regexp = "\\d{10,}", message = "Telephone must have at least 10 digits")
private String telephone;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)