• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JPA SQL with LIke operator

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne ,
Thanks for the reply.I tried as explained by you.Thanks


Regards
A.ArockiaRaj
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic