views:

338

answers:

1

I write this code in one variable in the IReport :

 $F{wbsWbkRef.wbkStdRef.stdBlRtntp.blCode} != null ?
 ReportUtil.getFirstEntity($P{JPA_ENTITY_MANAGER},
 "SELECT "+
 "CASE WHEN std.stdBlRtntp.blCode IN ('UNIVGRANT' ,   'BEHYAR','TEACHER','GRANTED','EXTGRANTED','EXTGRANTED') THEN "+
"DECODE (std.stdBlAcctp.blCode , 'UNIVGRANT' ,'داخل','BEHYAR','داخل','TEACHER','داخل','GRANTED','داخل','EXTGRANTED','خارج','EXTGRANTED','ترددي','غير بورس')      "+
"END AS SCHOLARSHIPTITLE "+
"FROM Student std "+
"WHERE std.stdId=:stdId ",
"stdId="+  $F{wbsWbkRef.wbkStdRef.stdId},
"stdId=java.math.BigDecimal")
: null

, but I get this error :

Caused by: java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.CaseNode
 \-[CASE] CaseNode: 'CASE'
    \-[WHEN] SqlNode: 'WHEN'
       +-[IN] InLogicOperatorNode: 'in'
       |  +-[DOT] DotNode: 'blookup1_.BL_CODE' {propertyName=blCode,dereferenceType=4,propertyPath=blCode,path=std.stdBlRtntp.blCode,tableA
p1_,className=com.ito.lms.persistence.BLookup,classAlias=null}
       |  |  +-[DOT] DotNode: 'student0_.STD_BL_RTNTP' {propertyName=stdBlRtntp,dereferenceType=1,propertyPath=stdBlRtntp,path=std.stdBlRtn
as=blookup1_,className=com.ito.lms.persistence.BLookup,classAlias=null}
       |  |  |  +-[ALIAS_REF] IdentNode: 'student0_.STD_ID' {alias=std, className=com.ito.lms.persistence.Student, tableAlias=student0_}
       |  |  |  \-[IDENT] IdentNode: 'stdBlRtntp' {originalText=stdBlRtntp}
       |  |  \-[IDENT] IdentNode: 'blCode' {originalText=blCode}
       |  \-[IN_LIST] SqlNode: 'inList'
       |     +-[QUOTED_STRING] LiteralNode: ''UNIVGRANT''
       |     +-[QUOTED_STRING] LiteralNode: ''BEHYAR''
       |     +-[QUOTED_STRING] LiteralNode: ''TEACHER''
       |     +-[QUOTED_STRING] LiteralNode: ''GRANTED''
       |     +-[QUOTED_STRING] LiteralNode: ''EXTGRANTED''
       |     \-[QUOTED_STRING] LiteralNode: ''EXTGRANTED''
       \-[METHOD_CALL] MethodNode: '('
          +-[METHOD_NAME] IdentNode: 'DECODE' {originalText=DECODE}
          \-[EXPR_LIST] SqlNode: 'exprList'
             +-[DOT] DotNode: 'blookup2_.BL_CODE' {propertyName=blCode,dereferenceType=4,propertyPath=blCode,path=std.stdBlAcctp.blCode,tab
okup2_,className=com.ito.lms.persistence.BLookup,classAlias=null}
             |  +-[DOT] DotNode: 'student0_.STD_BL_ACCTP' {propertyName=stdBlAcctp,dereferenceType=1,propertyPath=stdBlAcctp,path=std.stdBl
Alias=blookup2_,className=com.ito.lms.persistence.BLookup,classAlias=null}
             |  |  +-[ALIAS_REF] IdentNode: 'student0_.STD_ID' {alias=std, className=com.ito.lms.persistence.Student, tableAlias=student0_}
             |  |  \-[IDENT] IdentNode: 'stdBlAcctp' {originalText=stdBlAcctp}
             |  \-[IDENT] IdentNode: 'blCode' {originalText=blCode}
             +-[QUOTED_STRING] LiteralNode: ''UNIVGRANT''
             +-[QUOTED_STRING] LiteralNode: ''\u62f\u627\u62e\u644''
             +-[QUOTED_STRING] LiteralNode: ''BEHYAR''
             +-[QUOTED_STRING] LiteralNode: ''\u62f\u627\u62e\u644''
             +-[QUOTED_STRING] LiteralNode: ''TEACHER''
             +-[QUOTED_STRING] LiteralNode: ''\u62f\u627\u62e\u644''
             +-[QUOTED_STRING] LiteralNode: ''GRANTED''
             +-[QUOTED_STRING] LiteralNode: ''\u62f\u627\u62e\u644''
             +-[QUOTED_STRING] LiteralNode: ''EXTGRANTED''
             +-[QUOTED_STRING] LiteralNode: ''\u62e\u627\u631\u62c''
             +-[QUOTED_STRING] LiteralNode: ''EXTGRANTED''
             +-[QUOTED_STRING] LiteralNode: ''\u62a\u631\u62f\u62f\u64a''
             \-[QUOTED_STRING] LiteralNode: ''\u63a\u64a\u631 \u628\u648\u631\u633''

PLEASE help me ,

Thanks alot

Shariat

A: 

Nothing wrong with the Java code itself, but its not a good practice as well. The problem is either the Entity name the Hibernate is receiving, the classpath of this entity or the mapping of the entity to the table.

Start by checking the value of this parameter, $P{JPA_ENTITY_MANAGER}

Next times, i would suggest to put the business+logic in the backend, and deal with the report as Presentation, just send it ready parameters. That will help you a lot when maintaining or modifying the report later.

medopal