-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Collection, @Batch(size=3), fetch=LAZY and @Fetch(SELECT)
PostPosted: Wed Jun 16, 2010 12:35 am 
Newbie

Joined: Thu Jul 17, 2008 6:44 pm
Posts: 9
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>();


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.