1

我想使用现有的实体/DAO 在 RapidClipse 中生成一个交叉表。结果应加载到 XdevTable/XdevGrid

这可能吗,如果是的话怎么办?

在现有的 DAO 中,我放置了以下 JPA-SQL:

findAllForPivot(String pjahr, String pkontos)
    {
     select 
     l1Id,
     l1GroupName,
     l2Id,
     l2GroupName,
     sum( case when (monat = 1) then dbetrag end ) AS `jan`,
     sum( case when monat = 2 then dbetrag end ) AS `feb`,
     sum( case when monat = 3 then dbetrag end ) AS `mrz`,
     sum( case when monat = 4 then dbetrag end ) AS `apr`,
     sum( case when monat = 5 then dbetrag end ) AS `mai`,
     sum( case when monat = 6 then dbetrag end ) AS `jun`,
     sum( case when monat = 7 then dbetrag end ) AS `jul`,
     sum( case when monat = 8 then dbetrag end ) AS `aug`,
     sum( case when monat = 9 then dbetrag end ) AS `sep`,
     sum( case when monat = 10 then dbetrag end ) AS `okt`,
     sum( case when monat = 11 then dbetrag end ) AS `nov`,
     sum( case when monat = 12 then dbetrag end ) AS `dez`
     from VHibCrosUmsGiroOpaOmaReport
     where  jahr =:pjahr and kontoId in (:pkontos)
     group by l1Id, l1GroupName, l2Id, l2GroupName;
    }

每行都有一个或多个错误:选择后的第一个字段生成:

the field can not be resolved

第一条总和线生成(与所有其他总和线一样):

Multiple markers at this line - `jan` cannot be resolved to a type - case cannot be resolved - missing '(' at 
 'dbetrag' - missing RULE_ID at ',' - dbetrag cannot be resolved to a type - mismatched input '=' expecting 
 RULE_ID - monat cannot be resolved to a type - missing ')' at 'when' - missing '(' at '`jan`' - mismatched input 
 'then' expecting '{' - mismatched input 'AS' expecting '{'

...如果我在 SQL 接口中使用它,选择本身就可以正常工作。

这些字段也与定义的完全一样,如果我使用“findAll”,我将得到所有字段。

至少我想让交叉表结果出现在 XDevTable 中。
之后应该可以单击结果单元格以打开详细信息页面。

我的错误在哪里/出了什么问题?

提前谢谢你 rgds OpaHeinz

4

0 回答 0