mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-25 09:05:50 +00:00
set digit length to 10
This commit is contained in:
parent
0d9e882e54
commit
87c47746b4
1 changed files with 2 additions and 0 deletions
|
@ -18,6 +18,7 @@ package org.springframework.samples.petclinic.owner;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.Pattern;
|
||||||
import org.springframework.core.style.ToStringCreator;
|
import org.springframework.core.style.ToStringCreator;
|
||||||
import org.springframework.samples.petclinic.model.Person;
|
import org.springframework.samples.petclinic.model.Person;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
@ -57,6 +58,7 @@ public class Owner extends Person {
|
||||||
@Column(name = "telephone")
|
@Column(name = "telephone")
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
@Digits(fraction = 0, integer = 10)
|
@Digits(fraction = 0, integer = 10)
|
||||||
|
@Pattern(regexp = "\\d{10,}", message = "Telephone must have at least 10 digits")
|
||||||
private String telephone;
|
private String telephone;
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||||
|
|
Loading…
Reference in a new issue