1

为了使用hibernate从db中获取排序值,我使用这个NamedQuery:

@NamedQuery(
    name = "searchnearestdesc",
    query = "select t FROM Result t WHERE t.indec=:e"
        + "t.var<=:f ORDER BY var DESC"
    )

但是,我得到了异常,我的错误是什么?

4

1 回答 1

2

您的子句之间需要一个 AND,连接字符串时也不要忘记尾随空格;)

@NamedQuery(
name = "searchnearestdesc",
query = "select t FROM Result t WHERE t.indec=:e AND "
    + "t.var<=:f ORDER BY var DESC"
)
于 2012-11-11T13:02:53.647 回答