You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by tubin gen <fa...@gmail.com> on 2009/07/22 17:10:13 UTC

problem with pagination when hibernate result transformer is applied

   I am using hibernate criteria query to get data for my
AjaxFallbackDefaultDataTable, this datatable also  gives me pagination
parameters which I am apply  to criteria. .The entity I am using for the
criteria query has a  lazy load  collection ,and I need the size of the
collection  in the view , so If I donot  eager fetch  collection I end up
with n+1 selects .So to eager fetch collection and not to have duplicater
records I  added result transformer     Criteria.DISTINCT_ROOT_ENTITY anmd
fetchmode join .
Now the problem is with pagination ,
for example I have item and bids and the criteria query to fetch items with
eager fetch for bids  , suppose  query selects one item and   this item has
2 bids the query returns total 3 records and total record count will be 3
and now when I apply result transformer three records will reduce to one
record  , but pagination   information will be wrong , please help me how to
resolve this ?

Re: problem with pagination when hibernate result transformer is applied

Posted by fachhoch <fa...@gmail.com>.
here one more concern i did not mention before .

lets say  total records per page is 20  and the query fetched 2 items and
each item has 10 bids, so sql query will have  20 records and result
transformer will  reduce it to  two records  and user will see just 2
records instead of 20 per page ? is there a solution for this ?



James Carman-3 wrote:
> 
> Do a different query to ask how many there are than the one you use to
> return the data.
> 
> On Wed, Jul 22, 2009 at 11:10 AM, tubin gen<fa...@gmail.com> wrote:
>>   I am using hibernate criteria query to get data for my
>> AjaxFallbackDefaultDataTable, this datatable also  gives me pagination
>> parameters which I am apply  to criteria. .The entity I am using for the
>> criteria query has a  lazy load  collection ,and I need the size of the
>> collection  in the view , so If I donot  eager fetch  collection I end up
>> with n+1 selects .So to eager fetch collection and not to have duplicater
>> records I  added result transformer     Criteria.DISTINCT_ROOT_ENTITY
>> anmd
>> fetchmode join .
>> Now the problem is with pagination ,
>> for example I have item and bids and the criteria query to fetch items
>> with
>> eager fetch for bids  , suppose  query selects one item and   this item
>> has
>> 2 bids the query returns total 3 records and total record count will be 3
>> and now when I apply result transformer three records will reduce to one
>> record  , but pagination   information will be wrong , please help me how
>> to
>> resolve this ?
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/problem-with-pagination-when-hibernate-result-transformer-is-applied-tp24608353p24627326.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: problem with pagination when hibernate result transformer is applied

Posted by James Carman <jc...@carmanconsulting.com>.
Do a different query to ask how many there are than the one you use to
return the data.

On Wed, Jul 22, 2009 at 11:10 AM, tubin gen<fa...@gmail.com> wrote:
>   I am using hibernate criteria query to get data for my
> AjaxFallbackDefaultDataTable, this datatable also  gives me pagination
> parameters which I am apply  to criteria. .The entity I am using for the
> criteria query has a  lazy load  collection ,and I need the size of the
> collection  in the view , so If I donot  eager fetch  collection I end up
> with n+1 selects .So to eager fetch collection and not to have duplicater
> records I  added result transformer     Criteria.DISTINCT_ROOT_ENTITY anmd
> fetchmode join .
> Now the problem is with pagination ,
> for example I have item and bids and the criteria query to fetch items with
> eager fetch for bids  , suppose  query selects one item and   this item has
> 2 bids the query returns total 3 records and total record count will be 3
> and now when I apply result transformer three records will reduce to one
> record  , but pagination   information will be wrong , please help me how to
> resolve this ?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org