add more Jakarta Data test method signatures
This commit is contained in:
parent
4bb5bc60e9
commit
5cd6ec4b54
|
@ -18,6 +18,7 @@ import jakarta.data.repository.Save;
|
||||||
import jakarta.data.repository.Update;
|
import jakarta.data.repository.Update;
|
||||||
import org.hibernate.StatelessSession;
|
import org.hibernate.StatelessSession;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -38,6 +39,12 @@ public interface BookAuthorRepository {
|
||||||
@Insert
|
@Insert
|
||||||
void insertBooks2(Set<Book> books);
|
void insertBooks2(Set<Book> books);
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
List<Book> insertBooks3(List<Book> books);
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
Book[] insertBooks4(Book[] books);
|
||||||
|
|
||||||
@Find
|
@Find
|
||||||
Book book(String isbn);
|
Book book(String isbn);
|
||||||
|
|
||||||
|
@ -47,6 +54,9 @@ public interface BookAuthorRepository {
|
||||||
@Find
|
@Find
|
||||||
List<Book> booksWithPages(Iterable<Integer> pages);
|
List<Book> booksWithPages(Iterable<Integer> pages);
|
||||||
|
|
||||||
|
@Find
|
||||||
|
List<Book> booksWithPages(int pages);
|
||||||
|
|
||||||
@Find
|
@Find
|
||||||
Optional<Book> bookIfAny(String isbn);
|
Optional<Book> bookIfAny(String isbn);
|
||||||
|
|
||||||
|
@ -77,6 +87,9 @@ public interface BookAuthorRepository {
|
||||||
@Find
|
@Find
|
||||||
List<Book> byPubDate3(LocalDate publicationDate, Sort<? super Book>... order);
|
List<Book> byPubDate3(LocalDate publicationDate, Sort<? super Book>... order);
|
||||||
|
|
||||||
|
@Find
|
||||||
|
Stream<Book> byPubDate4(LocalDate publicationDate, Sort<? super Book> order);
|
||||||
|
|
||||||
@Find
|
@Find
|
||||||
Book[] bookArrayByTitle(String title);
|
Book[] bookArrayByTitle(String title);
|
||||||
|
|
||||||
|
@ -95,6 +108,9 @@ public interface BookAuthorRepository {
|
||||||
@Query("from Book where title = :title")
|
@Query("from Book where title = :title")
|
||||||
Book bookWithTitle(String title);
|
Book bookWithTitle(String title);
|
||||||
|
|
||||||
|
@Query("from Book where title = :title")
|
||||||
|
Optional<Book> bookWithTitleMaybe(String title);
|
||||||
|
|
||||||
@Query("from Book where title like :title")
|
@Query("from Book where title like :title")
|
||||||
List<Book> books0(String title);
|
List<Book> books0(String title);
|
||||||
|
|
||||||
|
@ -116,6 +132,9 @@ public interface BookAuthorRepository {
|
||||||
@Query("select title from Book where title like :title order by isbn")
|
@Query("select title from Book where title like :title order by isbn")
|
||||||
String[] titles1(String title);
|
String[] titles1(String title);
|
||||||
|
|
||||||
|
@Query("from Book")
|
||||||
|
Stream<Book> everyBook0(Order<? super Book> order);
|
||||||
|
|
||||||
@Query("from Book")
|
@Query("from Book")
|
||||||
List<Book> everyBook1(PageRequest<? super Book> pageRequest);
|
List<Book> everyBook1(PageRequest<? super Book> pageRequest);
|
||||||
|
|
||||||
|
@ -154,9 +173,21 @@ public interface BookAuthorRepository {
|
||||||
@Find
|
@Find
|
||||||
List<Book> allBooksWithLotsOfSorting(Sort<? super Book> s1, Order<? super Book> order, Sort<? super Book>... s3);
|
List<Book> allBooksWithLotsOfSorting(Sort<? super Book> s1, Order<? super Book> order, Sort<? super Book>... s3);
|
||||||
|
|
||||||
|
@Query("where price < ?1 and pages > ?2")
|
||||||
|
Book[] valueBooks0(BigDecimal maxPrice, int minPages);
|
||||||
|
|
||||||
|
@Query("where price < :maxPrice and pages > :minPages")
|
||||||
|
Book[] valueBooks1(BigDecimal maxPrice, int minPages);
|
||||||
|
|
||||||
|
@Query("where price < :price and pages > :pages")
|
||||||
|
Book[] valueBooks2(@Param("price") BigDecimal maxPrice, @Param("pages") int minPages);
|
||||||
|
|
||||||
@Save
|
@Save
|
||||||
Book write(Book book);
|
Book write(Book book);
|
||||||
|
|
||||||
|
@Update
|
||||||
|
Book edit(Book book);
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
Iterable<Book> createAll(Iterable<Book> books);
|
Iterable<Book> createAll(Iterable<Book> books);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import static org.hibernate.processor.test.util.TestUtil.getMetaModelSourceAsStr
|
||||||
*/
|
*/
|
||||||
public class EgTest extends CompilationTest {
|
public class EgTest extends CompilationTest {
|
||||||
@Test
|
@Test
|
||||||
@WithClasses({ Publisher.class, Author.class, Book.class, Library.class })
|
@WithClasses({ Publisher.class, Author.class, Address.class, Book.class, Library.class })
|
||||||
public void test() {
|
public void test() {
|
||||||
System.out.println( getMetaModelSourceAsString( Author.class ) );
|
System.out.println( getMetaModelSourceAsString( Author.class ) );
|
||||||
System.out.println( getMetaModelSourceAsString( Book.class ) );
|
System.out.println( getMetaModelSourceAsString( Book.class ) );
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.hibernate.processor.test.data.eg;
|
||||||
|
|
||||||
import jakarta.data.page.CursoredPage;
|
import jakarta.data.page.CursoredPage;
|
||||||
import jakarta.data.page.PageRequest;
|
import jakarta.data.page.PageRequest;
|
||||||
|
import jakarta.data.repository.By;
|
||||||
import jakarta.data.repository.Delete;
|
import jakarta.data.repository.Delete;
|
||||||
import jakarta.data.repository.Find;
|
import jakarta.data.repository.Find;
|
||||||
import jakarta.data.repository.Insert;
|
import jakarta.data.repository.Insert;
|
||||||
|
@ -20,6 +21,9 @@ public interface Library {
|
||||||
@Find
|
@Find
|
||||||
Book book(String isbn);
|
Book book(String isbn);
|
||||||
|
|
||||||
|
@Find
|
||||||
|
List<Book> books(@By("isbn") List<String> isbns);
|
||||||
|
|
||||||
@Find
|
@Find
|
||||||
Book books(String title, LocalDate publicationDate);
|
Book books(String title, LocalDate publicationDate);
|
||||||
|
|
||||||
|
@ -38,14 +42,20 @@ public interface Library {
|
||||||
@Insert
|
@Insert
|
||||||
void create(Book book);
|
void create(Book book);
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
void create(Book[] book);
|
||||||
|
|
||||||
@Update
|
@Update
|
||||||
void update(Book book);
|
void update(Book book);
|
||||||
|
|
||||||
|
@Update
|
||||||
|
void update(Book[] books);
|
||||||
|
|
||||||
@Delete
|
@Delete
|
||||||
void delete(Book book);
|
void delete(Book book);
|
||||||
|
|
||||||
@Update
|
@Delete
|
||||||
void update(Book[] books);
|
void delete(Book[] book);
|
||||||
|
|
||||||
@Save
|
@Save
|
||||||
void upsert(Book book);
|
void upsert(Book book);
|
||||||
|
@ -67,4 +77,10 @@ public interface Library {
|
||||||
@OrderBy("name")
|
@OrderBy("name")
|
||||||
@OrderBy("address.city") //not working currently
|
@OrderBy("address.city") //not working currently
|
||||||
List<Author> authors();
|
List<Author> authors();
|
||||||
|
|
||||||
|
@Find
|
||||||
|
List<Author> authorsByCity(@By("address.city") String city);
|
||||||
|
|
||||||
|
@Find
|
||||||
|
List<Author> authorsByCityAndPostcode(String address_city, String address_postcode);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue