You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metamodel.apache.org by "longxin (JIRA)" <ji...@apache.org> on 2018/11/12 03:47:00 UTC

[jira] [Comment Edited] (METAMODEL-1202) Bad Query use limit and offset methods with Oracle.(oracle数据库分页查询返回结果错误)

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

longxin edited comment on METAMODEL-1202 at 11/12/18 3:46 AM:
--------------------------------------------------------------

[~kaspersor] Tks, you told me the truth!!! By the way, when i do this code :

SatisfiedQueryBuilder<?> limitQuery = dataSelect.orderBy("ID").limit(pageSize).offset(pageSize * (pageNum - 1));
 logger.info("select query no params={}", limitQuery.toQuery().toSql());

Just got above:

select query no params=SELECT "TEST_TEST"."ID", "TEST_TEST"."NAME" FROM OBJUSER."TEST_TEST" ORDER BY "TEST_TEST"."ID" ASC

How can i get the full query MetaModel truly pruduced?


was (Author: longxin):
[~kaspersor] Tks, you told me the truth!!! By the way, when i do this code :

SatisfiedQueryBuilder<?> limitQuery = dataSelect.orderBy("ID").limit(pageSize).offset(pageSize * (pageNum - 1));
 logger.info("select query no params={}", limitQuery.toQuery().toSql());

Just got above:

select query no params=SELECT "TEST_TEST"."ID", "TEST_TEST"."NAME" FROM OBJUSER."TEST_TEST" ORDER BY "TEST_TEST"."ID" ASC

How can i get the full query MetaModel truly pruduced.

> Bad Query use limit and offset methods with Oracle.(oracle数据库分页查询返回结果错误)
> ------------------------------------------------------------------------
>
>                 Key: METAMODEL-1202
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-1202
>             Project: Apache MetaModel
>          Issue Type: Bug
>    Affects Versions: 5.1.0
>            Reporter: longxin
>            Priority: Critical
>
> 1) My database table :TEST_TEST
>  
> ||ID||NAME||
> |6|name6|
> |5|name5|
> |4|name4|
> |3|name3|
> |2|name2|
> |1|name1|
> 2)Query builder as:
> Schema defaultSchema = context.getDefaultSchema();
>  SatisfiedSelectBuilder<?> dataSelect = context.query()
>  .from("TEST_TEST")
>  .select("ID","NAME");
> SatisfiedQueryBuilder<?> limitQuery =
>           dataSelect.offset(2).limit(2);
> DataSet dataSet = limitQuery.excute();
> 3)Problem:
> expect to get row(ID:4) and row(ID:3), but get row(ID:2) and row(ID:1)



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