• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA SQL with LIke operator

 
Arockia Raj
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am getting exception when using 'like' operator with 'upper' function in JPA sQL.

Below SQL is working
select * from Customer customer where UPPER(customer.custName)= UPPER(:custName)

If i change '=' to like in the above SQL its not working.

select * from Customer customer where UPPER(customer.custName) LIKE UPPER(:custName)

and getting below exception..
Caused by: org.apache.openjpa.persistence.ArgumentException: Encountered "UPPER ( customer . custName ) LIKE UPPER" at character 90,

Any idea why this is happening.

Thanks and Regards
A.Raj


 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you try using this query?



If this works, you can call toUpper() in Java when setting the binding variable.
 
Arockia Raj
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne ,
Thanks for the reply.I tried as explained by you.Thanks


Regards
A.ArockiaRaj
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic