File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes need help in EJB QL with upper and like Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "need help in EJB QL with upper and like" Watch "need help in EJB QL with upper and like" New topic
Author

need help in EJB QL with upper and like

Tanveer Rameez
Ranch Hand

Joined: Dec 11, 2000
Posts: 158
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

Joined: Dec 11, 2000
Posts: 158
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
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
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.


I think, therefore I exist -- Rene Descartes
 
Don't get me started about those stupid light bulbs.
 
subject: need help in EJB QL with upper and like
 
Similar Threads
Seemingly simple EJB-QL question
Please help me on using EJB-QL with JBoss 4.0
Problem on Resin CMP
problem in finder method
CMP ejb-ql query