Oracle paging query times with hibernate ora-00923:from keyword not found where expected __oracle

Source: Internet
Author: User
Query q=super.getsession (). CreateQuery ("from Eventinfoall");             Q.setfirstresult (1); Q.setmaxresults (3);

Using hibernate to implement MySQL SQL Server paging is no problem, but there is a problem with Oracle, always error
Ora-00923:from keyword not found where expected
The FROM keyword was not found
But if you use it directly
Query q=super.getsession (). CreateQuery ("from Eventinfoall");
Is the one that can return all the result sets.
The problem is not the HQL statement I wrote.
Then I analyzed the question of whether the jar package, I tried to download multiple versions of the Oracle10 jar package, but the result is the same, reported the same error.
This way, the jar pack problem is eliminated.
Oracle-related is only the spring configuration file, I was surprised to find that in the configuration hibernate.dialect, I actually use the Org.hibernate.dialect.SQLSERVERDialect
, immediately modified to org.hibernate.dialect.OracleDialect, the problem solved, the paging effect came out.
Summary: Database with Oracle, dialect with SQL Server, this should be a description, hibernate in the processing of the two databases on the page is not the same, so the error, but also explains some of the base
This query processing should be the same, so the direct query can display the result set.
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.