Use Subquery in FROM clause Hibernate HQL -


this hql query, , throwing "invalid token select". how can implement it, read hibernate doesn't support subquery in clause.

select subq.workitemid ,subq.subject, subq.workitemcrtddt, subq.workitemduedt, subq.workitemrcpntnm, subq.workitemcrtrnm, subq.lkworkitemstatuscd,subq.lkworkitemprioritycd                                           (select wi workitem wi, workitemrecipient wir                        wi.workitemid = wir.workitem.id ,                     (wi.workitemcreateuserid=:userid or                      (wir.recipientid= :userid or (wir.recipientid= :alluserid , wir.recipientorgid= :userorgid)))) subq 

your query rewritten regular select, need resolve subq correct alias.

assuming:

table: workitem has columns: workitemid , subject, workitemcrtddt, workitemduedt, workitemcrtrnm, lkworkitemstatuscd, lkworkitemprioritycd

table: workitemrecipient has columns: workitemrcpntnm

then query be:

select wi.workitemid ,wi.subject, wi.workitemcrtddt, wi.workitemduedt, wir.workitemrcpntnm, wi.workitemcrtrnm, wi.lkworkitemstatuscd,wi.lkworkitemprioritycd      workitem wi, workitemrecipient wir      wi.workitemid = wir.workitem.id      , (wi.workitemcreateuserid=:userid or  wir.recipientid= :userid or (wir.recipientid= :alluserid , wir.recipientorgid= :userorgid))) 

no need sub-select in clause.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -