使用hibernate从db获取排序值,我使用这个NamedQuery:
@NamedQuery(
name = "searchnearestdesc",
query = "select t FROM Result t WHERE t.indec=:e"
+ "t.var<=:f ORDER BY var DESC"
)
但是,我得到例外, 我的错误是什么?
答案 0 :(得分:2)
你的子句之间需要AND,在连接字符串时也不要忘记尾随空格;)
@NamedQuery(
name = "searchnearestdesc",
query = "select t FROM Result t WHERE t.indec=:e AND "
+ "t.var<=:f ORDER BY var DESC"
)