Hi,
can someone experienced elaborate on the $subj please?
I have a collection, which can get huge - 10000's of entities.
This caused enormous joins when I used it in some HQL queries.
So I put
Code:
@org.hibernate.annotations.Fetch(FetchMode.SELECT)
on it. This works.
Then, I wondered about @Batch - is it appropriate? How would it work?
So I put it there, but see no change in behavior. Hibernate still sends queries with no LIMIT (MySQL 5.1).
Is LAZY fetch necessary to get this to work?
I would expect EAGER + SELECT to fetch the first batch eagerly and the rest lazily.
Is there some broader explanation of how @Batch works with collections?
Thanks.
Code:
@OneToMany(mappedBy="owner", cascade=CascadeType.ALL, fetch=FetchType.LAZY)
@OrderBy("skupina, subjekt.druh")
@org.hibernate.annotations.Fetch(FetchMode.SELECT)
@org.hibernate.annotations.BatchSize(size=3)
private Set<Subjekt> sledovaneSubjekty = new HashSet<Subjekt>();