English 中文(简体)
IReport Case in Variable
原标题:

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:   u62fu627u62eu644  
             +-[QUOTED_STRING] LiteralNode:   BEHYAR  
             +-[QUOTED_STRING] LiteralNode:   u62fu627u62eu644  
             +-[QUOTED_STRING] LiteralNode:   TEACHER  
             +-[QUOTED_STRING] LiteralNode:   u62fu627u62eu644  
             +-[QUOTED_STRING] LiteralNode:   GRANTED  
             +-[QUOTED_STRING] LiteralNode:   u62fu627u62eu644  
             +-[QUOTED_STRING] LiteralNode:   EXTGRANTED  
             +-[QUOTED_STRING] LiteralNode:   u62eu627u631u62c  
             +-[QUOTED_STRING] LiteralNode:   EXTGRANTED  
             +-[QUOTED_STRING] LiteralNode:   u62au631u62fu62fu64a  
             -[QUOTED_STRING] LiteralNode:   u63au64au631 u628u648u631u633  
问题回答

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.





相关问题
passing form variables into a url with php

I have the following form which allows a user to select dates/rooms for a hotel reservation. <form action="booking-form.php" method="post"> <fieldset> <div class="select-date">...

Error: "Cannot modify the return value" c#

I m using auto-implemented properties. I guess the fastest way to fix following is to declare my own backing variable? public Point Origin { get; set; } Origin.X = 10; // fails with CS1612 Error ...

C-style Variable initialization in PHP

Is there such a thing as local, private, static and public variables in PHP? If so, can you give samples of each and how their scope is demonstrated inside and outside the class and inside functions?

C#/.NET app doesn t recognize Environment Var Change (PATH)

In my C# app, I am programmatically installing an Oracle client if one is not present, which requires adding a dir to the PATH system environment variable. This all works fine, but it doesn t take ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

How to dynamically generate variables in Action Script 2.0

I have a for loop in action script which I m trying to use to dynamically create variable. Example for( i = 0 ; i &lt 3 ; i++) { var MyVar+i = i; } after this for loop runs, i would like to ...

热门标签