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
Joined: Dec 11, 2000
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
Joined: Feb 17, 2005
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.