-->
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: Joining & "Filtering"
PostPosted: Fri Nov 11, 2005 12:49 pm 
Newbie

Joined: Thu Apr 15, 2004 4:31 pm
Posts: 7
Hibernate version:
Hibernate 3.1 beta 3

I'm trying to find a more efficient version of paging a collection from an entity. Current method is like this:

Code:

// The entity we get the un-initalized collection from
List queue = container.getQueue();

getSession().createFilter(queue, "").setFirstResult(0).setMaxResults(10);



Unfortunately this doen't allow us to join without resorting to sql using this method.

Ideally we could have a method such as:
Code:

// The entity we get the un-initalized collection from
Collection queue = container.getQueue();

getSession().createCriteria(queue).addJoin().setFetchMode("someProperty", FetchMode.JOIN).setFirstResult(0).setFetchSize(10);



However as this is not avaliable, then way that we are currently doing this is:


Code:

// The entity we get the un-initalized collection from
Collection queue = container.getQueue();

getSession().createFilter(queue, "").setFirstResult(0).setMaxResults(10);

// for each of the entries, call Hibernate.initalize(subProperty);



As we have a lot of properties which need to be fetched for each of the elements in the queue, this is a higly inefficient method.

If anyone has any thoughs on this they would be very helpful.

Matt.

[/code]


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.