• 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

need help in EJB QL with upper and like

 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a SQL query which finds all the rows having a column name where the value contains the word 'wimpey' in it irrespective of case.the SQL is :

I am writing a CMP entity bean where there is a finder method findName. the EJB QL and the xml in the ejb-jar.xml is:

The ?1 corresponds ot the parameter passed as String to the method. but ofcourse this EJB QL does not work as it seems EJB QL 2.0 does not support upper.
So I changed the query to

But again the deployment to the server complains that there is a problem with 'like'. Please note that the table has column 'name'
I am using Oracle Application server standalone OC4J. the error message is :
oracle.oc4j.admin.internal.DeployerException: Error initializing ejb-module; Exception Error translating EJBQL: Encountered "o . name LIKE ?1" at line 1, column 8.

I have two question:
1. How do I write a EJB QL which tries to find rows having the word passed a parameter in a partcilar column irrespective of case
2. what's wring with my EJB QL even after I remove the upper, i.e what's wring with this:

Please help me as i need to complete the entity bean ASAP.

thanks in advance.
Tanveer
 
Tanveer Rameez
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The EJB QL

can be used instead of LIKE.
but my second problem is to make the search case insensitive. how do I do that. I am using Oracle Application Server (oc4j).
thanks
Tanveer
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tanveer,


2. what's wring with my EJB QL even after I remove the upper, i.e what's wring with this:

select object(o) from MyTable o where o.name LIKE ?1


It�s absolutely nothing wrong with this query. The LIKE operator it�s allowed in EJB QL. However I can only suggest you to check again if the MyTable is the name of the table or the name of the bean�s abstract schema that maps to that table. You probably should use the abstract schema name along with the name of the <cmp-fields>, not the names defined in the database schema.
Regards.
 
reply
    Bookmark Topic Watch Topic
  • New Topic