Win a copy of Head First Android this week in the Android forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

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: 40796
828
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic