You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2019/02/02 11:10:00 UTC

[jira] [Commented] (OPENJPA-2771) It seems like h2 'unlimited' is not "LIMIT 0" but rather "LIMIT -1"

    [ https://issues.apache.org/jira/browse/OPENJPA-2771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16758957#comment-16758957 ] 

ASF subversion and git services commented on OPENJPA-2771:
----------------------------------------------------------

Commit 43aa42ccb533212db9acf1a238d24172b18dc513 in openjpa's branch refs/heads/master from Mark Struberg
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=43aa42c ]

OPENJPA-2771 fix h2 'unlimited' LIMIT case

With h2 one should omit the LIMIT section to get all results.
Our old LIMIT 0 did effectively prune the whole result list to zero entries.


> It seems like h2 'unlimited' is not "LIMIT 0" but rather "LIMIT -1"
> -------------------------------------------------------------------
>
>                 Key: OPENJPA-2771
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2771
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 3.0.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Major
>             Fix For: 3.0.1
>
>
> Our H2Dictionary currently sets {{LIMIT 0 OFFSET 3}} when a {{Query#setFirstResult(3)}} is set without any {{setMaxResults}}. 
> This results in zero entries in the result list.
> When I set {{LIMIT -1}, then all works fine.
> According to the h2database documentation at http://h2database.com/html/grammar.html we can assume the followint:
> {quote}LIMIT and FETCH FIRST/NEXT ROW(S) ONLY limits the number of rows returned by the query (no limit if null or smaller than zero). OFFSET specified how many rows to skip{quote}
> If I read this correctly then we can skip the whole LIMIT clause if no {{setMaxResults}} was set.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)