Hi
this topic is very important for my app and I would like to know if the bug have been handled for the next release please.
Thanks.


-------- Original Message --------
Subject: [Resin-interest] I don't understand the sql requests made by manager.createQuery when using setFirstResult
Date: Sun, 03 Aug 2008 14:57:19 +0200
From: Riccardo Cohen <[EMAIL PROTECTED]>
Reply-To: General Discussion for the Resin application server <resin-interest@caucho.com>
Organization: Articque
To: General Discussion for the Resin application server <resin-interest@caucho.com>


Hello
I've downloaded the latest snapshot of 3.2 and found a strange behaviour. Whe I call this :

      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();

I have this :

if start = 0 and count=5 the sql request is

[14:40:49.245] {http--8000-7} start=0 cnt=5
[14:40:49.260] {http--8000-7} adlresintest.1.0:prepareStatement(select h.adlid, h.adlfirstname, h.adlname from adluser h order by h.adlid LIMIT 25,type=1003,concurrency=1007)
[14:40:49.260] {http--8000-7} adlresintest.1.0:executeQuery(select h.adlid, h.adlfirstname, h.adlname from adluser h order by h.adlid LIMIT 25)
[14:40:49.267] {http--8000-7} adlresintest.1:isClosed() -> false
[14:40:49.267] {http--8000-7} adlresintest.1.1:prepareStatement(select h.adlid, h.adlfirstname, h.adlname from adluser h order by h.adlid,type=1003,concurrency=1007)
[14:40:49.267] {http--8000-7} adlresintest.1.1:executeQuery(select h.adlid, h.adlfirstname, h.adlname from adluser h order by h.adlid)

if start = 0 and count=500

[14:38:01.530] {http--8000-6} start=0 cnt=500
[14:38:01.531] {http--8000-6} adlresintest.0.16:prepareStatement(select h.adlid, h.adlfirstname, h.adlname from adluser h order by h.adlid LIMIT 25,type=1003,concurrency=1007)
[14:38:01.531] {http--8000-6} adlresintest.0.16:executeQuery(select h.adlid, h.adlfirstname, h.adlname from adluser h order by h.adlid LIMIT 25)
[14:38:01.533] {http--8000-6} adlresintest.0:isClosed() -> false
[14:38:01.535] {http--8000-6} adlresintest.0.17:prepareStatement(select h.adlid, h.adlfirstname, h.adlname from adluser h order by h.adlid LIMIT 25, 475,type=1003,concurrency=1007)
[14:38:01.535] {http--8000-6} adlresintest.0.17:executeQuery(select h.adlid, h.adlfirstname, h.adlname from adluser h order by h.adlid LIMIT 25, 475)

if start = 22 and count=5 the sql request is

[14:43:36.249] {http--8000-15} start=22 cnt=5
[14:43:36.249] {http--8000-15} adlresintest.2.2:prepareStatement(select h.adlid, h.adlfirstname, h.adlname from adluser h order by h.adlid LIMIT 25,type=1003,concurrency=1007)
[14:43:36.257] {http--8000-15} adlresintest.2.2:executeQuery(select h.adlid, h.adlfirstname, h.adlname from adluser h order by h.adlid LIMIT 25)
[14:43:36.260] {http--8000-15} adlresintest.2:isClosed() -> false
[14:43:36.260] {http--8000-15} adlresintest.2.3:prepareStatement(select h.adlid, h.adlfirstname, h.adlname from adluser h order by h.adlid LIMIT 25, 2,type=1003,concurrency=1007)
[14:43:36.260] {http--8000-15} adlresintest.2.3:executeQuery(select h.adlid, h.adlfirstname, h.adlname from adluser h order by h.adlid LIMIT 25, 2)


This creates 2 requests instead of one if start<25, and the LIMIT clause is not always what needed. Is there any particular reason for that ?

But now if start>25 :

[14:44:43.237] {http--8000-4} start=26 cnt=5
[14:44:43.237] {http--8000-4} adlresintest.3.2:prepareStatement(select h.adlid, h.adlfirstname, h.adlname from adluser h order by h.adlid LIMIT 26, 5,type=1003,concurrency=1007)
[14:44:43.238] {http--8000-4} adlresintest.3.2:executeQuery(select h.adlid, h.adlfirstname, h.adlname from adluser h order by h.adlid LIMIT 26, 5)

Here there is only one request and it seems correct (the select works in mysql console), but the resulting list is empty in java.

Thanks for any information.

--

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

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

Reply via email to