-1

Here is my query:

String queryString = "SELECT A,B,C,D from Table1 T1,TABLE2 T2"
              +" WHERE T1.A=T2.D"
              +" AND T1.B=T2.C";

int start=0,limit=15;

Here I am executing queryString by setting start and limit

List queryList = executeReadAllSQLQuery(queryString);


int totalcount = queryList.size();
System.out.println("before => " +totalcount);
String PaginationQuery = queryString+" LIMIT "+ start +","+ limit;
List queryList2 = executeReadAllSQLQuery(PaginationQuery); // **ERROR/EXCEPTION**

Exception : Caused by: java.sql.SQLException: ORA-00933: SQL command not properly ended

Please help me resolve this issue.

Mat
  • 188,820
  • 38
  • 367
  • 383
Dev
  • 3,714
  • 3
  • 22
  • 40

1 Answers1

1

In Hibernate use this one please to limit your selection:

List result = session.createQuery("from TableName").setFirstResult(0).setFetchSize(200).list();

This will Select like this one limit 0,200

you can write the values you want in setFirstResult and setFetchSize

This one will be general with any DATABASE ENGINE

Regards,