Hi
I checked on 07/07 snapshot and the behaviour is conform now.
But there is still a bug in the couple setFirstResult() and setMaxResults().

I have a small sample where I can select first item and count. The count is set to 20.
When I set first = 0 I have 25 items returned. Same until 5.
When I set first = 6, I have only 19 results
When I set first = 10, I have only 15 results
When I set first = 22, I have only 3 results
for all those, the sql select ends by LIMIT 25

Now if I set first=25, the the select is correct : LIMIT 25, 20 and I really have 20 items. Same for higher values.

No emergency but just for info.
Thanks.


ps: the code is

      javax.persistence.Query hqr=m_manager.createQuery("select h from Adluser h order by h.id");
      log.info("start="+numstart+" cnt="+numcnt);
      hqr.setFirstResult(numstart);
      hqr.setMaxResults(numcnt);
      ret=(List<Adluser>)hqr.getResultList();



Scott Ferguson wrote:
On Jun 18, 2008, at 1:47 PM, Riccardo Cohen wrote:

  
Hi
I use javax.persistence.Query to retreive entity beans throught the
EntityManager.
I have to use setFirstResult() and setMaxResults() to implement next
page / previous page functions.
I found 2 strange things about it :
    

Thanks.  I've filed this as http://bugs.caucho.com/view.php?id=2746

-- Scott

  
1) setMaxResults does not fix the "maximum number of results to
retrieve" as the docs says, but indeed the last row number to  
retreive.
Example :

hqr.setFirstResult(50);
hqr.setMaxResults(60);
gives :
51 : 51 51
52 : 52 52
53 : 53 53
54 : 54 54
55 : 55 55
56 : 56 56
57 : 57 57
58 : 58 58
59 : 59 59
60 : 60 60

2) the LIMIT sql function seems partially implemented. The previous
request calls this :(sql spy=true)

select h.adlid, h.adlfirstname, h.adlname from adluser h order by
h.adlid LIMIT 60

While it should call LIMIT 50,10 (and actually it should call LIMIT
50,60 if you beleive the javax.persistence.Query doc).
It seems that it is the java code that eliminate the 50 first rows.
Imagine I want the rows 10000 to 10005, It seems that the database  
will
return 10005 rows and the java code will throw the 10000 first

I found nothing about this in recent archives. Thanks for any
information about these 2 topics.
I use Resin 3.1.5 and also 3.2.0 snapshot 18th mai on MacOsX,
the database is mysql 5.0.37 with latest mysql java driver
mysql-connector-java-5.1.6-bin.jar

--
Riccardo Cohen



_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest
    



_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

  

--

Riccardo Cohen Développeur
logo Articque Articque Décisionnel
149, av. du Gal De Gaulle
Fondettes, 37230
France

www.articque.com
Tél: +33(0)2.47.49.73.74
Fax: +33(0)2.47.49.91.49
_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to