本文介绍了EclipseLink中用于NamedQuery的SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Eclipselink

   select o  from user o where trunc(o.TRSF_DATE) = ?1 and o.contrno in(?2,?3,?4,?5,?6,?7,?8,?9,?10,?11)

我遇到以下错误

   Internal Exception: NoViableAltException(83!=[661:1: simpleConditionalExpressionRemainder[Object left] returns [Object node] : (n= compariso
nExpression[left] | (n1= NOT )? n= conditionWithNotExpression[(n1!=null), left] | IS (n2= NOT )? n= isExpression[(n2!=null), left] );])
        at org.eclipse.persistence.exceptions.JPQLException.unexpectedToken(JPQLException.java:372)

此致

推荐答案

我的猜测是该错误是由截断引起的,该截断不是有效的JPQL函数.在EclipseLink中,可以使用FUNC关键字来调用数据库函数.

My guess is that the error is caused by trunc, which is not a valid JPQL function. In EclipseLink you can use the FUNC keyword to call a database function.

看, http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development /Querying/Support_for_Native_Database_Functions

这篇关于EclipseLink中用于NamedQuery的SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 08:24