mirror of
https://github.com/Example-uPagge/hibernate-multiple-bag-fetch-exception.git
synced 2024-06-15 10:55:24 +03:00
update
This commit is contained in:
parent
806106a735
commit
65de6d5a7b
@ -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();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user