You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by C N Davies <cn...@cndavies.com> on 2009/10/02 18:46:51 UTC

Result limit

Is there any way to limit the size of a result set so that you an specify
the maximum number of records returned?

 

I tried:

 

Query.setHint("openjpa.hint.OptimizeResultCount",new Integer(100))

 

But the generated SQL has no sign of it. I was expecting the generated SQL
to include the LIMIT keyword however it doesn't.

 

Using OpenJPA 1.2.1 and MySQL 5.

 

Chris


Re: Result limit

Posted by Daryl Stultz <da...@6degrees.com>.
On Sat, Oct 3, 2009 at 4:42 AM, C N Davies <cn...@cndavies.com> wrote:

> Hmm but shouldn't the list server handle that? Maybe I'll re-subscribe and
> see if it fixes it.
>

Maybe there's a setting on your preferences for your subscription to CC you?

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com

RE: Result limit

Posted by C N Davies <cn...@cndavies.com>.
Hmm but shouldn't the list server handle that? Maybe I'll re-subscribe and
see if it fixes it.

-----Original Message-----
From: Daryl Stultz [mailto:daryl@6degrees.com] 
Sent: Saturday, 3 October 2009 6:12 AM
To: users@openjpa.apache.org
Subject: Re: Result limit

On Fri, Oct 2, 2009 at 3:38 PM, C N Davies <cn...@cndavies.com> wrote:

>
> Not sure about the return address, shouldn't the list server do this for
me
> automatically?
>
>
Yeah, Chris, when I reply to your messages I see the list and your email, I
usually delete your email and send just to the list.

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com


Re: Result limit

Posted by Daryl Stultz <da...@6degrees.com>.
On Fri, Oct 2, 2009 at 3:38 PM, C N Davies <cn...@cndavies.com> wrote:

>
> Not sure about the return address, shouldn't the list server do this for me
> automatically?
>
>
Yeah, Chris, when I reply to your messages I see the list and your email, I
usually delete your email and send just to the list.

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com

RE: Result limit

Posted by C N Davies <cn...@cndavies.com>.
Perfect!  Thanks Milosz.

Not sure about the return address, shouldn't the list server do this for me automatically?

-----Original Message-----
From: Miłosz Tylenda [mailto:mtylenda@o2.pl] 
Sent: Saturday, 3 October 2009 4:27 AM
To: users@openjpa.apache.org
Subject: Re: Result limit

Chris,

Have you tried Query.setMaxResults(int)? This should be what you are looking
for.

The mentioned hint has currently effect only with DB2. It appends to the
generated SQL some DB2-specific syntax so that the database knows we are
expecting from the query N rows. The database then can optimize its query plan. The
hint does not however change the number of rows returned.

BTW, your mail has Reply-To set to your address, not the list.

Cheers,
Milosz


> Is there any way to limit the size of a result set so that you an specify
> the maximum number of records returned?
> 
>  
> 
> I tried:
> 
>  
> 
> Query.setHint("openjpa.hint.OptimizeResultCount",new Integer(100))
> 
>  
> 
> But the generated SQL has no sign of it. I was expecting the generated SQL
> to include the LIMIT keyword however it doesn't.
> 
>  
> 
> Using OpenJPA 1.2.1 and MySQL 5.
> 
>  
> 
> Chris
> 
> 


Re: Result limit

Posted by Miłosz Tylenda <mt...@o2.pl>.
Chris,

Have you tried Query.setMaxResults(int)? This should be what you are looking
for.

The mentioned hint has currently effect only with DB2. It appends to the
generated SQL some DB2-specific syntax so that the database knows we are
expecting from the query N rows. The database then can optimize its query plan. The
hint does not however change the number of rows returned.

BTW, your mail has Reply-To set to your address, not the list.

Cheers,
Milosz


> Is there any way to limit the size of a result set so that you an specify
> the maximum number of records returned?
> 
>  
> 
> I tried:
> 
>  
> 
> Query.setHint("openjpa.hint.OptimizeResultCount",new Integer(100))
> 
>  
> 
> But the generated SQL has no sign of it. I was expecting the generated SQL
> to include the LIMIT keyword however it doesn't.
> 
>  
> 
> Using OpenJPA 1.2.1 and MySQL 5.
> 
>  
> 
> Chris
> 
>