关于jpa 查询MySQL 最后插入的一条数据
在数据库中,同一个用户插入了N条数据,现在想使用jpa 查询这个用户最后插入的一条数据,日志报line 1:161: unexpected token: LIMIT。
我的HQL语句是这样的
String hql = "select new map(ls.userName as userName,ls.x as x ,ls.y as y ) from LocationSharing ls where ls.userName = :userName ORDER by ls.id DESC LIMIT 1";
在MySQL查询里面敲入这条sql语句是可以查询出来的。求大神