[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [eclipselink-users] Named Native Query is not producing LIMIT based queries with setMaxResults
|
- From: Tim Hollosy <hollosyt@xxxxxxxxx>
- Date: Tue, 21 Jul 2009 14:45:18 -0400
- Delivered-to: eclipselink-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=L3g13MLmSVetFlyTNpOFTrxxNECN9u0GLrqUcJsUiKQ=; b=OPp6u5WemUcxiwfisvUDUXwqz15dClaqN8VvZlSvtqx8gFr3mzdlvZ93xchuIzL33a gXn/hBPDSTSau9Qylo7stwSBnTg2puZi+tUNK6N5gfHHBtZwkuc287sjAYi8hVDYglAh 2yiA/rd4/QvAwA1tL/Hp1mrJ79ETvCOBnDGnI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=HQMo9dJAwW8a6RimMIK2WFPKxcQDs9xYZjFzFva/39VU8NkA2m0ez0xwRKOjyQ/7SZ DhwCRd7FSlFEMjVFF/AhsMd3P/REEvufeR6GJJVOnsshrmDhvUbtm8VLYxiPWCdhwPw2 RtpG30sBybx1Xybb7T/5GUQtAZlKtLFvHyDSU=
Thanks Tom,
That answers my question -- so the entire result is still downloaded
if you have a native named query. Interesting information :) Should I
file a bug to request this functionality be added? I think it should
be the desired behavior.
./tch
On Tue, Jul 21, 2009 at 2:35 PM, Tom Ware<tom.ware@xxxxxxxxxx> wrote:
> Hi Tim,
>
> Is the romnum part of the query missing for a standard Named Query or just
> for a Named Native Query?
>
> I ran a quick test and I seem to get the proper rownum SQL for a dynamic
> query and a normal named query.
>
> If the issue you are seeing is for a Named Native Query, at the moment we
> do not edit the SQL you provide to add the rownum syntax. The way we deal
> with firstResult and maxRows in native queries is to get the full result set
> from the query and to use indices to return the requested results.
>
> I cannot think of a way of getting the number of results from a select
> query that is better than just adding a count of some field to the result
> set.
>
> -Tom
>
> Tim Hollosy wrote:
>>
>> I'm hoping someone can help explain the native paging feature in
>> Eclipse Link. I am using the oracle platform, when I call
>> setFirstResult setMaxResults on a JPA Query the SQL that gets produced
>> and logged by EclipseLink contains the normal limit stuff with rownum.
>>
>> However if I do the same thing, but produce my query by calling
>> createNamedQuery paging still works but the SQL that gets logged (and
>> maybe not even executed) isn't the LIMIT stuff, it just looks like the
>> regular ol' NativeNamedQuery. This is causing some issues for us since
>> we're trying to do some string processing on the SQL in order to
>> dynamically create a count query (minus the subselect limit/rownum).
>>
>> So I have two questions:
>>
>> 1) How does this even work, since I don't see the LIMIT based query
>> being created, yet paging seems to still work. Yet with a JPA query
>> you can clearly see the LIMIT SQL being created/executed.
>>
>> 2) Is there an easier way to get the count from a query without having
>> to dynamically (or statically) creating the SQL?
>>
>> Thanks!
>>
>> ./tch
>> _______________________________________________
>> eclipselink-users mailing list
>> eclipselink-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>