Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Eclipselink 2.5.2 giving exception on executing jpql having CASE expression
Eclipselink 2.5.2 giving exception on executing jpql having CASE expression [message #1434737] Tue, 30 September 2014 14:04 Go to next message
Abhijeet Bongarde is currently offline Abhijeet BongardeFriend
Messages: 2
Registered: September 2014
Junior Member
I have a JPQL generated using eclipselink 2.5.2

SELECT t0 FROM DM_CONV_PUMP t0 WHERE (CASE WHEN t0.SUPPLIER_NAME LIKE 'bb%' THEN TRUE ELSE FALSE END) = true AND t0.TEIID_MULTI_DATA_SOURCE_COLUMN = 'EDM_sql'

I am getting following exception:
java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing [SELECT t0 FROM DM_CONV_PUMP t0 WHERE (CASE WHEN t0.SUPPLIER_NAME LIKE 'bb%' THEN TRUE ELSE FALSE END) = true AND t0.TEIID_MULTI_DATA_SOURCE_COLUMN = 'EDM_sql'].
[86, 86] The identifier THEN is missing from the WHEN clause.
[76, 80] The identification variable 'THEN' cannot be a reserved word.
org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1605)


This works in Eclipselink2.4.1.
While debugging, I found that 'DefaultEclipseLinkJPQLGrammar' is not able to parse 'THEN' keyword.

Is there any changes in Eclipselink2.5.2 which is causing this issue?

Re: Eclipselink 2.5.2 giving exception on executing jpql having CASE expression [message #1435137 is a reply to message #1434737] Wed, 01 October 2014 04:11 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Odd, the parser seems to pick up 'THEN" as an identification variable. Please file a bug, and try using "CASE WHEN (t0.SUPPLIER_NAME LIKE 'bb%') THEN.." to see if that makes any difference. If not, an alternative workaround would be to use criteria api.

Best Regards,
Chris
Re: Eclipselink 2.5.2 giving exception on executing jpql having CASE expression [message #1435247 is a reply to message #1435137] Wed, 01 October 2014 07:58 Go to previous message
Abhijeet Bongarde is currently offline Abhijeet BongardeFriend
Messages: 2
Registered: September 2014
Junior Member
Thanks Chris, we tried the workaround that you have provided and it works for us.

Still we will go ahead and file a BUG for it.
Previous Topic:EclipseLink 2.5.2 multi root JPQL/Criteria issue
Next Topic:Jpa prepersist callback not called on parent
Goto Forum:
  


Current Time: Thu Apr 25 16:31:46 GMT 2024

Powered by FUDForum. Page generated in 0.04486 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top