HHH-17895 tests for Bean Validation annotations in Jakarta Data

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-03-27 10:08:30 +01:00
parent 12b3afced0
commit 823d0de8d5
1 changed files with 11 additions and 7 deletions

View File

@ -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<Book> books(@By("isbn") List<String> isbns);
List<Book> books(@By("isbn") @NotEmpty List<String> isbns);
@Find
Book book(String title, LocalDate publicationDate);
Book book(@NotBlank String title, @NotNull LocalDate publicationDate);
@Find
List<Book> publications(Type type, Sort<Book> sort);
List<Book> publications(@NotNull Type type, Sort<Book> sort);
@Find
@OrderBy("title")
List<Book> booksByPublisher(String publisher_name);
List<Book> 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<Author> allAuthors(Order<Author> order, Limit limit);
@Find
List<Author> authorsByCity(@By("address.city") String city);
List<Author> authorsByCity(@By("address.city") @NotBlank String city);
@Find
List<Author> authorsByCityAndPostcode(String address_city, String address_postcode);