Reputation: 263
My Query in java:
QUERY_STRING = "select a.seqNum,a.eventId,a.srcAddress,a.srcUser,REPLACE(a.message,',',' ') as message,a.createdTime,a.type,a.networkGroupName from Fraud a";
Getting Exception as Follows:
04:38:55,193 ERROR AppEntityManager:90 - java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.MethodNode
+-[METHOD_CALL] MethodNode: '('
| +-[METHOD_NAME] IdentNode: 'REPLACE' {originalText=REPLACE}
| \-[EXPR_LIST] SqlNode: 'exprList'
| +-[DOT] DotNode: 'fraud0_.MESSAGE' {propertyName=message,dereferenceType=4,propertyPath=message,path=a.message,tableAlias=fraud0_,className=com.redshift.mgmt.entity.Fraud,classAlias=a}
| | +-[ALIAS_REF] IdentNode: 'fraud0_.ALERT_ID' {alias=a, className=com.redshift.mgmt.entity.Fraud, tableAlias=fraud0_}
| | \-[IDENT] IdentNode: 'message' {originalText=message}
| +-[QUOTED_STRING] LiteralNode: '',''
| \-[QUOTED_STRING] LiteralNode: '' ''
Upvotes: 1
Views: 4457
Reputation: 16430
The replace function is not known to Hibernate so it also doesn't know the result type that it should use for retrieving results from JDBC. Either register the function in your Dialect or wrap a cast around: CAST(REPLACE(a.message,',',' ') as java.lang.String)
Upvotes: 4