Hi, I am a novice in Hibernate field.
I have a SQL query like
select distinct atd.docID, atd.Doctitle,col.collectionName, atm.ActionPerformed,atm.ActionDateTime,atm.UserID, (Case when atd.totalNoOfAccess = -1 then a.TotalNoOfAccess else atd.totalNoOfAccess end)TotalNoOfAccess, (Case when atd.DocID not in (Select DocID from TblDocMasterIdentification) then 'Deleted' else dmi.status end)CurrentStatus
from TblAuditTrailMaster atm ,TblAuditTrailDoc atd, TblCollections col,tblDocInformation a,TblDocMasterIdentification dmi
where atm.AuditID = atd.AuditID and atd.CollectionID = col.CollectionID and atd.docID = dmi.docID and atd.docID = a.docID and atm.AuditID in
(select max(atm.AuditID) from TblAuditTrailMaster atm )
i want to convert this into hibernate query. i know its a bit complex, but i want to know how can i add if condition like case in SQL for conditional selection in hibernate
some one pls help.....
Thanks in advance.
|