You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by fengyi <li...@sina.com> on 2013/07/03 07:34:03 UTC

about slice query with paging. the result have some wrong

hello everyone: 
    I very like openJPA slice . and  in our project, slice plays a import
role. 
but when i configured slice. and query with paging. the result have some
mistake. 
db is mysql-5.5。 i have two db ,configured for slice. when i query the
pageno gt 1 ,then the query result 
goes wrong . i think this because of slices excute the paging query
individually,and then,the program merge the each slice result. 
for example: 
my whole data is : 1,2,3,4,5,6,7,8,,9,10,11,12 
two slice. 
the first slice holds data 1,3,5,7,9,11  and the second slice holds data
2,4,6,8,10,12 
 pageSize is 2. 
page 1 result is 1,3  (1,3,2,4) 
page 2 result is 5,7 (5,7,6,8) 
page 3 result is 9,1 (9,11,10,12) 

some data missed. 

my team solution is use a delegate query when invoke the  query page
interface.  Cooperate with query Cache, the method can resolve our problem
temporarilly. 
any one have more advice? 



--
View this message in context: http://openjpa.208410.n2.nabble.com/about-slice-query-with-paging-the-result-have-some-wrong-tp7584326.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: about slice query with paging. the result have some wrong

Posted by fengyi <li...@sina.com>.
     i test again, the result set size is right,it's the pagesize.because the
all the slices  return the same pagesize result,then the result will be
selected again in the memory.
    now i just simply x10 with the pagesize。 then order, and select。 because
the miss data always happend at the  edge of pagesize. configured with 
query cache, work not bad!



--
View this message in context: http://openjpa.208410.n2.nabble.com/about-slice-query-with-paging-the-result-have-some-wrong-tp7584326p7584411.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: about slice query with paging. the result have some wrong

Posted by Pinaki Poddar <pp...@apache.org>.
Hi Fengyi,
  As per your reported data, the query result is not missing records, but
the page size is longer than you requested. For example if you request a
page size of P and have N slices, the the query will return P*N rows per
page. 
  This is surely a bug, albeit a minor one. A simple solution is to set the
page size to be P/N. then the actual page size will be P/N * N = P i.e what
you wanted originally. 



-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: http://openjpa.208410.n2.nabble.com/about-slice-query-with-paging-the-result-have-some-wrong-tp7584326p7584410.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.