Hi,
I have a query I could perfectly execute with JDBC which I need to return results in pages. The query must return a list of Strings. For example in MySQL:
Code:
"SELECT t.stringCol FROM my_table AS t order by t.stringCol LIMIT 10, 10"
As specifying a "LIMIT" is not standard I wanted to see if there was a way of adapting this to Hibernate's Query; something like:
Code:
String sqlQuery = "select t.stringCol from my_table as t order by t.stringCol"
Query query = session.createSQLQuery(sqlQuery, "", String.class);
query.setMaxResults(pageSize);
query.setFirstResult(pageSize*pageNumber);
List res = query.list();
In this case I'd get a "no persister for java.lang.String" error, but maybe I could create a dummy class for getting the string or an integer.
Any ideas would be appreciated.
Thanks in advance for your help!!
Andr