Can anyone please tell me with an example, how to retrieve the last row in the table. I am using MySQL and Hibernate
I have tried with max(rowid), order by desc limit 1. But it doesn't work. I am getting an error,"could not execute Query" You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from' at line 1"
The code is:
String sqlquery="select MAX(rplogid) from rplogtable";
Query query = session1.createQuery(sqlquery);
List lst=query.list();
Integer x=(Integer)lst.get(0);
System.out.println("Value of max(rplogid)="+lst.get(0));
data=(RPLog)session1.get(pkg1.RPLog.class, x);
Please help me. I am struggling with this one for more than a day.