List<AC_Customer> lastAC_CustomersList = session.createQuery("from AC_Customer order by customer_pk DESC LIMIT 1").list()
当我执行此操作时,我得到了这个错误,任何人都可以告诉我什么是我的hql查询的wron。
org.hibernate.hql.internal.ast.QuerySyntaxException:意外令牌:LIMIT靠近第1行第65列[来自com.softlogic.models.AC_Customer order by customer_pk DESC LIMIT 1]
答案 0 :(得分:2)
尝试使用以下
Observable
.from(gates)
.flatMap(gate -> mDataManager.getGateById(gate.getCode()))
答案 1 :(得分:0)
org.hibernate.hql.internal.ast.QuerySyntaxException:意外令牌:第1行第87列附近的偏移量[FROM om.omantel.prodsheet.models.RtcsProduct,其中status = 1由TRACKING_ID DESC偏移量排列1行抓取下一个5仅行]
@SuppressWarnings("unchecked")
@Override
public List<RtcsProduct> pagination(int page_id, int total) {
String listsql = "FROM RtcsProduct where status=1 order by TRACKING_ID DESC OFFSET "+page_id+" ROWS FETCH NEXT "+total+" ROWS ONLY";
Session session = null;
List<RtcsProduct> productlist = null;
try {
if (session == null) {
session = sessionFactory.openSession();
session.beginTransaction();
productlist = session.createQuery(listsql).list();
session.getTransaction().commit();
}
}catch(Exception ex) {
ex.printStackTrace();
}
return productlist;
}