The paging code becomes invalid due to a strange issue.

Source: Internet
Author: User

The paging code becomes invalid due to a strange issue.

Previously, I encountered a page failure problem on the interface, which had plagued me for several days. The problem was solved when the backend was located as a sorting failure problem...

Problem description:

A paging function on the interface is invalid. The paging Effect on the first, second, and last pages is normal, but the paging data in the middle remains unchanged. QA raised a Bug about this.

Problem Analysis:

1. Analyze the Page code

The code for page paging is a component that is used in many projects. The code for invalid pages is not customized or used.

2. Analysis of front-end and back-end Interaction

The HTTP-based monitoring tool finds that all request data for paging requests is normal, the start/limit data for paging is correct, the filtering conditions are correct, and the front-end problems are eliminated.

3. Background code analysis

The background code is DAO query and Analysis Based on Hibernate. The Code is based on regular queries of the base class, and no special code exists. In addition, regular queries of these base classes are used by different modules in the project, and other modules function normally.

Therefore, I am skeptical about the existence of the query code.

4. Check whether the generated SQL is faulty.

Print the SQL statement used in the query. After analysis, the SQL statement does not have a problem. Log4jdbc is used to monitor SQL Execution.

5. run SQL directly in Oracle plsql Based on the SQL used in the query

It is found that ~ 75, 75 -~ The query data remains unchanged. SQL statement:

 select *          from (select row_.*, rownum rownum_            from (select this_.id          as id25_0_,                         this_.create_time as create2_25_0_,                         this_.creator     as creator25_0_,                         this_.modify_time as modify4_25_0_,                         this_.updater     as updater25_0_,                         this_.version     as version25_0_,                         this_.bank_id     as bank7_25_0_,                         this_.bank_name   as bank8_25_0_,                         this_.chk_comment as chk9_25_0_,                         this_.chk_status  as chk10_25_0_,                         this_.cup_bank_id as cup11_25_0_,                         this_.del_status  as del12_25_0_,                         this_.smp_name    as smp13_25_0_,                         this_.status      as status25_0_                    from ns_para_bank this_                   where this_.chk_status = '02'                     and this_.chk_status = '02'                     and this_.del_status = '01'                   order by this_.modify_time desc                   ) row_           where rownum <= 100)         where rownum_ > 75
6. It is suspected that the Order field is modifyTime.

After investigation, it is found that most of the data in the modifiedTime field is empty, which leads to invalid sorting. As a result, the paging data remains unchanged.

Problem Solving

A new sorting field is added to the sorting condition. When modified_time is invalid, the validity of the overall sorting can be ensured to solve the paging failure problem.

Appendix

1. http://blog.csdn.net/lcj8/article/details/4720032 of using rownum of Oralce

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.