select中的别名没有'分组工作

时间:2015-01-07 10:43:45

标签: jpa select jpql

我有以下jpa / jpql查询:

select doiPoolName, (case when strpos(errormessage, 'Error exporting DOI') > 0 then 'Error exporting DOI' else errormessage end ) as errormes, count(*)
from DoiError doiError
where errortime >= to_timestamp('2015-01-06 10:45:00', 'YYYY-MM-DD HH24:MI:SS')
group by doiPoolName, errormes
order by errormes asc

将以下列形式在SQL中翻译:

select
  doierror0_.doiPoolName as col_0_0_,
  case
    when strpos(errormessage, 'Error exporting DOI')>0 then 'Error exporting DOI' else errormessage
  end as col_1_0_,
  count(*) as col_2_0_
from
  ERROR doierror0_
where
  errortime>=to_timestamp(?, 'YYYY-MM-DD HH24:MI:SS')
group by
  doierror0_.doiPoolName ,
  errormes
order by
  col_1_0_ asc

通过执行查询,我收到以下错误:

  

“错误:列”错误“不存在”

我很确定问题出在,而不是 col_1_0 _ 错误这意味着它不存在正确“翻译”......

有没有办法解决这个问题?

0 个答案:

没有答案