Hi,
I've a query in MySQL which includes CASE.... WHEN...
THEN...THEN....END type, which i working fine.
select cds.id,
case when cds.source_type = 'c'
then (select cm.company_name from esi_companymaster cm where
cm.company_code = cds.source_id)
when cds.source_type = 'd'
then (select dm.dealer_name from esi_dealermaster dm where
dm.dealer_code = cds.source_id) end
as company_dealer_name
from esi_cds_issues_dispensary_details cds
But when I converted the same into HQL, like the below one:
select cds.id,
case when cds.sourceType is 'c'
then (select cm.companyName from CompanyMaster cm where cm.companyCode
= cds.sourceId)
when cds.sourceType is 'd'
then (select dm.dealerName from DealerMaster dm where dm.dealerCode =
cds.sourceId) end
as company_dealer_name
from IssuestoDispenceryDetails cds
I m getting NullPointerException (unexpected AST node: query) exception.
Can any one suggest me what am I doing wrong? or is there any work
around for this.
I need this very urgent. Thanks in advance.
Regards,
ManiKanta G