<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Helvetica, Arial, sans-serif">Hi,<br>
<br>
I've a query in MySQL which includes CASE.... WHEN...
THEN...THEN....END type, which i working fine.<br>
<br>
select cds.id,<br>
case when cds.source_type = 'c'<br>
then (select cm.company_name from esi_companymaster cm where
cm.company_code = cds.source_id)<br>
when cds.source_type = 'd'<br>
then (select dm.dealer_name from esi_dealermaster dm where
dm.dealer_code = cds.source_id) end<br>
as company_dealer_name<br>
from esi_cds_issues_dispensary_details cds<br>
<br>
But when I converted the same into HQL, like the below one: <br>
<br>
select cds.id,<br>
case when cds.sourceType is 'c'<br>
then (select cm.companyName from CompanyMaster cm where cm.companyCode
= cds.sourceId)<br>
when cds.sourceType is 'd'<br>
then (select dm.dealerName from DealerMaster dm where dm.dealerCode =
cds.sourceId) end<br>
as company_dealer_name<br>
from IssuestoDispenceryDetails cds<br>
<br>
I m getting NullPointerException (unexpected AST node: query) exception.<br>
<br>
Can any one suggest me what am I doing wrong? or is there any work
around for this. <br>
<br>
I need this very urgent. Thanks in advance.<br>
<br>
<br>
Regards,<br>
ManiKanta G<br>
<br>
</font></font>
</body>
</html>