Skip to content

Commit 0ad4bba

Browse files
committed
Fix: Add validation constraints to model classes (#147)
1 parent 8409c0a commit 0ad4bba

File tree

1 file changed

+3
-1
lines changed
  • src/main/java/org/springframework/samples/petclinic/model

1 file changed

+3
-1
lines changed

src/main/java/org/springframework/samples/petclinic/model/Pet.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -19,6 +19,7 @@
1919
import org.springframework.beans.support.PropertyComparator;
2020

2121
import jakarta.persistence.*;
22+
import jakarta.validation.constraints.NotNull; // Added this import
2223
import java.time.LocalDate;
2324
import java.util.*;
2425

@@ -35,6 +36,7 @@
3536
public class Pet extends NamedEntity {
3637

3738
@Column(name = "birth_date", columnDefinition = "DATE")
39+
@NotNull // Added this annotation
3840
private LocalDate birthDate;
3941

4042
@ManyToOne(cascade = CascadeType.ALL)

0 commit comments

Comments
 (0)