From 823d0de8d591a7150407fab4b615d8f8b860e0bf Mon Sep 17 00:00:00 2001 From: Gavin King Date: Wed, 27 Mar 2024 10:08:30 +0100 Subject: [PATCH] HHH-17895 tests for Bean Validation annotations in Jakarta Data Signed-off-by: Gavin King --- .../processor/test/data/eg/Library.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/eg/Library.java b/tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/eg/Library.java index a65168f93f..cc4ced1555 100644 --- a/tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/eg/Library.java +++ b/tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/eg/Library.java @@ -15,6 +15,10 @@ import jakarta.data.repository.Repository; import jakarta.data.repository.Save; import jakarta.data.repository.Update; import jakarta.transaction.Transactional; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import java.time.LocalDate; import java.util.List; @@ -24,20 +28,20 @@ import java.util.List; public interface Library { @Find - Book book(String isbn); + Book book(@NotNull String isbn); @Find - List books(@By("isbn") List isbns); + List books(@By("isbn") @NotEmpty List isbns); @Find - Book book(String title, LocalDate publicationDate); + Book book(@NotBlank String title, @NotNull LocalDate publicationDate); @Find - List publications(Type type, Sort sort); + List publications(@NotNull Type type, Sort sort); @Find @OrderBy("title") - List booksByPublisher(String publisher_name); + List booksByPublisher(@NotBlank String publisher_name); @Query("where title like :titlePattern") @OrderBy("title") @@ -79,7 +83,7 @@ public interface Library { void update(Author author); @Save - void save(Publisher publisher); + void save(@Valid Publisher publisher); @Delete void delete(Publisher publisher); @@ -94,7 +98,7 @@ public interface Library { List allAuthors(Order order, Limit limit); @Find - List authorsByCity(@By("address.city") String city); + List authorsByCity(@By("address.city") @NotBlank String city); @Find List authorsByCityAndPostcode(String address_city, String address_postcode);