我正在使用此代码构建表达式:
Expression<Long> t = builder.function("least", Long.class, root.<Long>get("RId"), builder.<Long>literal(new Long(1)));
相当于:
LEAST(RId, 1)
但我收到了错误:
java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.MethodNode
但如果我改用它:
Expression<Long> t = builder.function("trunc", Long.class, root.<Long>get("RId"));
它有效。有人可以帮忙吗?