HQL和ケースを休止状態時にJavaの問題で、その後、他のエンドの実行

FatemehのAsadi:

私は実行する必要があるHQL queryときで、その後、他のエンド句合計とJavaの中で問題なく実行することpostgres

SELECT r.reviewer_id,
  sum(case when c.service_type = 'مالتی مدیا' AND c.genre_id = '66c92962-324c-11e7-93ae-92361f002671' then 1 else 0 end) image_multimedia,
  sum(case when c.service_type is null AND c.genre_id = '66c92b1a-324c-11e7-93ae-92361f002671' then 1 else 0 end) image_null

 FROM module_samim.content c
  Join module_samim.content_reviewer r on c.id = r.content_id
  Join module_samim.file f on f.id = c.file_id
  Group by r.reviewer_id

私はそれを実行しようとしたcreateQuery()が、私は得ます:

Sep 11, 2018 8:57:20 AM org.hibernate.hql.internal.ast.ErrorCounter reportError
ERROR: line 1:58: expecting "then", found 'مدیاAND'
line 1:58: expecting "then", found 'مدیاAND'
and

Sep 11, 2018 8:57:20 AM org.hibernate.hql.internal.ast.ErrorCounter reportError
ERROR: line 1:264: unexpected token: image_null
Sep 11, 2018 8:57:20 AM org.hibernate.hql.internal.ast.ErrorCounter reportError
ERROR: line 1:264: unexpected token: image_null
line 1:264: unexpected token: image_null

私を助けてください!ありがとうございました!

FatemehのAsadi:

私は解決策を見つけました:))私が使用createNativeQuery()して@SqlResultSetMappingはで説明し、このリンクは完全に私の問題を解決するために

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=221180&siteId=1