Java 25299 Fixes made for spring-data-jpa-repo-3 test failures in integration-jdk9-and-above (#14906)

This commit is contained in:
Bipin kumar 2023-10-18 15:26:35 +05:30 committed by GitHub
parent c3c8b1d016
commit 140974c9bf
3 changed files with 6 additions and 6 deletions

View File

@ -19,7 +19,7 @@ public class Library {
private List<String> addresses = new ArrayList<>();
@ElementCollection(targetClass = String.class, fetch = FetchType.EAGER)
@CollectionTable(name = "book", joinColumns = @JoinColumn(name = "library_id"))
@CollectionTable(name = "books", joinColumns = @JoinColumn(name = "library_id"))
@Column(name = "book", nullable = false)
private List<String> books = new ArrayList<>();

View File

@ -1,5 +1,5 @@
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=none
spring.jpa.generate-ddl=true
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE

View File

@ -21,13 +21,13 @@ public class BookPagingAndSortingRepositoryIntegrationTest {
@Test
public void givenDbContainsBooks_whenfindBooksByAuthor_thenReturnBooksByAuthor() {
Book book1 = new Book("Spring Data", "John Doe", "1234567890");
Book book2 = new Book("Spring Data 2", "John Doe", "1234567891");
Book book3 = new Book("Spring Data 3", "John Doe", "1234567892");
Book book1 = new Book("Spring Data", "John Miller", "1234567890");
Book book2 = new Book("Spring Data 2", "John Miller", "1234567891");
Book book3 = new Book("Spring Data 3", "John Miller", "1234567892");
bookPagingAndSortingRepository.saveAll(Arrays.asList(book1, book2, book3));
Pageable pageable = PageRequest.of(0, 2, Sort.by("title").descending());
List<Book> books = bookPagingAndSortingRepository.findBooksByAuthor("John Doe", pageable);
List<Book> books = bookPagingAndSortingRepository.findBooksByAuthor("John Miller", pageable);
Assertions.assertEquals(2, books.size());
Assertions.assertEquals(book3.getId(), books.get(0).getId());
Assertions.assertEquals(book2.getId(), books.get(1).getId());