在运行jpql时面临java.lang.IllegalStateException

时间:2016-04-27 17:22:25

标签: java oracle jpa hql jpql

我正在运行一段给我带来麻烦的代码。 我已经提到了下面的代码和详细的错误消息。

String queryString =    "select  DECODE(instr(nvl(max(t.stringValue), 'NA'), 'CONS_PRICE'),0,'N','Y') as isConsPrice" +
            " from   Table t where   t.identifier = 'JOB_METHOD' ";

Query query = entityManager.createQuery(queryStrinf,String.class); -- getting error
String isConsPrice = query.getSingleResult();

我也提供了详细的错误消息

 No data type for node: org.hibernate.hql.internal.ast.tree.MethodNode 
 \-[METHOD_CALL] MethodNode: '('
    +-[METHOD_NAME] IdentNode: 'DECODE' {originalText=DECODE}
    \-[EXPR_LIST] SqlNode: 'exprList'
       +-[METHOD_CALL] MethodNode: '('
       |  +-[METHOD_NAME] IdentNode: 'instr' {originalText=instr}
       |  \-[EXPR_LIST] SqlNode: 'exprList'
       |     +-[METHOD_CALL] MethodNode: '('
       |     |  +-[METHOD_NAME] IdentNode: 'nvl' {originalText=nvl}
       |     |  \-[EXPR_LIST] SqlNode: 'exprList'
       |     |     +-[AGGREGATE] AggregateNode: 'max'
       |     |     |  \-[DOT] DotNode: 'hexgeninit0_.STRING_VALUE' {propertyName=stringValue,dereferenceType=PRIMITIVE,getPropertyPath=stringValue,path=hexInit.stringValue,tableAlias=hexgeninit0_,className=com.hexgen.orm.HexgenInit,classAlias=hexInit}
       |     |     |     +-[ALIAS_REF] IdentNode: 'hexgeninit0_.ID' {alias=hexInit, className=com.hexgen.orm.HexgenInit, tableAlias=hexgeninit0_}
       |     |     |     \-[IDENT] IdentNode: 'stringValue' {originalText=stringValue}
       |     |     \-[QUOTED_STRING] LiteralNode: ''NA''
       |     \-[QUOTED_STRING] LiteralNode: ''CONS_PRICE''
       +-[NUM_INT] LiteralNode: '0'
       +-[NUM_INT] LiteralNode: '2'
       \-[NUM_INT] LiteralNode: '3'

0 个答案:

没有答案