• 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

EJB-QL input parameter problem.

 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,
I got very simple EJB-QL statement and using CMP.

![CDATA[SELECT OBJECT(o) FROM CompanyVendorBean o WHERE o.CO_NUM = ?1 and o.VEND_NUM = ?2]]
I found that the input parameter must be upper case.
Do anyone know what the problem is? Can I change to case insensitive?
thanks
Benson
 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unless you have the attributes declared as CO_NUM and VEND_NUM, you shouldn't have to call them using upper case.
Make sure you have them declared like co_num and vend_num...make sure they are not declared with upper case....also..if any of these fields represents a CMR field you should check the deployment descriptor and make sure that the CMR field <cmr-field-name> is not declared with upper case.
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Benson Fung:
I found that the input parameter must be upper case.
Do anyone know what the problem is? Can I change to case insensitive?


If you mean that the *data* is in uppercase and thus you need to uppercase the input parameters themselves (not the CMP field names in the EJB-QL, though those should be standard JavaBeans identifiers like coNum and vendNum to match the getCoNum() and getVendNum() accessors), you'll need to do one of the following.
  • Wait for EJB 2.1 compliant servers to implement the UPPER EJB-QL function.
  • Use your vendor's EJB-QL extensions if they implement UPPER.
  • Uppercase the parameter in a facade method before passing it to the finder.

  • If you need to perform a case-insensitive search against a mixed-case attribute, you may have to do a funky work-around to avoid using vendor extensions.
    If you're using Oracle and WebLogic, for example, you could create a function-based index on the column and use WebLogic's syntax for passing a select hint to Oracle. This way you won't have to uppercase the parameter. However, you're tied to both Oracle and WebLogic at that point.
    I got around this by adding another attribute that is the uppercase version of the attribute I want to search (email in my case). When email is set, I also set the uppercased version. The finder then searches on this new attribute, and I uppercase the parameter before feeding it to the finder. This way I'm not using any WL- or Oracle-specific features from my beans.
    I would have been tempted to use the select hint, but that would require embedding "'/* use <index> */'" in the EJB-QL. Since I'm using XDoclet to generate the finders, the EJB-QL is in the class's JavaDoc, and the */ would terminate the comment.
     
    Consider Paul's rocket mass heater.
    reply
      Bookmark Topic Watch Topic
    • New Topic