This commit is contained in:
kriti20041 2025-12-25 14:39:32 +00:00 committed by GitHub
commit 70a5d7c970
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,6 +20,7 @@ import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;
import jakarta.validation.constraints.NotNull;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.samples.petclinic.model.NamedEntity;
@ -45,12 +46,13 @@ import jakarta.persistence.Table;
@Table(name = "pets")
public class Pet extends NamedEntity {
@Column
@NotNull(message = "Birth date is required")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate birthDate;
@ManyToOne
@JoinColumn(name = "type_id")
private PetType type;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)