This commit is contained in:
Struchkov Mark 2022-07-02 18:53:22 +03:00
parent 806106a735
commit 65de6d5a7b

View File

@ -4,6 +4,7 @@ import dev.struchkov.example.hibernate.nbfe.fix.domain.Post;
import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManager;
import jakarta.persistence.EntityManagerFactory; import jakarta.persistence.EntityManagerFactory;
import jakarta.persistence.Persistence; import jakarta.persistence.Persistence;
import org.hibernate.annotations.QueryHints;
import java.util.List; import java.util.List;
@ -21,6 +22,7 @@ public class FixProblem {
where p.id between :minId and :maxId""", Post.class) where p.id between :minId and :maxId""", Post.class)
.setParameter("minId", 1L) .setParameter("minId", 1L)
.setParameter("maxId", 50L) .setParameter("maxId", 50L)
.setHint("PASS_DISTINCT_THROUGH", false)
.getResultList(); .getResultList();
posts = entityManager.createQuery(""" posts = entityManager.createQuery("""
@ -29,6 +31,7 @@ public class FixProblem {
left join fetch p.tags t left join fetch p.tags t
where p in :posts""", Post.class) where p in :posts""", Post.class)
.setParameter("posts", posts) .setParameter("posts", posts)
.setHint("PASS_DISTINCT_THROUGH", false)
.getResultList(); .getResultList();
final long finishTime = System.currentTimeMillis(); final long finishTime = System.currentTimeMillis();