Fix compile error

This commit is contained in:
Christian Beikov 2023-01-25 17:34:15 +01:00
parent 49779ed4dc
commit e464f53df8
1 changed files with 5 additions and 4 deletions

View File

@ -2,6 +2,7 @@ package org.hibernate.orm.test.batch;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import org.hibernate.annotations.BatchSize; import org.hibernate.annotations.BatchSize;
@ -18,7 +19,7 @@ import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType; import jakarta.persistence.GenerationType;
import jakarta.persistence.Id; import jakarta.persistence.Id;
import jakarta.persistence.ManyToMany; import jakarta.persistence.ManyToMany;
import jakarta.persistence.Query; import jakarta.persistence.TypedQuery;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
@ -64,12 +65,12 @@ public class BatchPaginationTest {
scope.inTransaction( scope.inTransaction(
entityManager -> { entityManager -> {
statementInspector.clear(); statementInspector.clear();
Query query = entityManager.createQuery( "select a from Article a" ); TypedQuery<Article> query = entityManager.createQuery( "select a from Article a", Article.class );
List<Article> tech = query.setMaxResults( 20 ).getResultList(); List<Article> tech = query.setMaxResults( 20 ).getResultList();
tech.stream() tech.stream()
.map( ArticleResponseDto::new ) .map( ArticleResponseDto::new )
.toList(); .collect( Collectors.toList() );
assertThat( statementInspector.getSqlQueries().size() ).isEqualTo( 2 ); assertThat( statementInspector.getSqlQueries().size() ).isEqualTo( 2 );
} }
); );
@ -84,7 +85,7 @@ public class BatchPaginationTest {
this.id = article.getId(); this.id = article.getId();
this.tags = article.getTags().stream() this.tags = article.getTags().stream()
.map( TagDto::new ) .map( TagDto::new )
.toList(); .collect( Collectors.toList());
} }
} }