This week's book giveaway is in the Functional programming forum.
We're giving away four copies of A Functional Approach to Java: Augmenting Object-Oriented Java Code with Functional Principles and have Ben Weidig on-line!
See this thread for details.
  • 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
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

EJB-QL input parameters CANNOT be used in LIKE expression.

 
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


input parameters CANNOT be used in LIKE expression.



What the heck? So, I cannot do something like:

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lynette Dawson,

No, We can use LIKE expression.

And the example you have given is correct. you can look page 419 of HFEJB for some examples.

Thanks,
Ugender
 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ugender Rekulampally:
Lynette Dawson,

No, We can use LIKE expression.

And the example you have given is correct. you can look page 419 of HFEJB for some examples.



Sorry man,

The example doesn't specify that it accepts input parameters. Someone needs to clarify that.

Thanks,
Chandu
 
Ugender Rekulampally
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chandra,
Yes, you are right. I was thinking Lynette was asking 'LIKE' can be used or not. So I haven't read the question well all along then.

Ugender
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lynette,

you can try:
SELECT a FROM Address AS a WHERE a.address_1 like '?1'

and put the '%' in the String you use as the first parameter, e.g.
"%church%"

Herman
 
Richard Green
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

you can try:
SELECT a FROM Address AS a WHERE a.address_1 like '?1'


according to http://java.boot.by/bcd-guide/ch09s03.html, that is not allowed.
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Lynette,

You're right, it's also not allowed according to the specs:
(11.2.7.4)
Input parameters can only be used in comparison_expressions or
collection_member_expressions, as defined in Section 11.4, �EJB QL BNF�.

Herman
 
reply
    Bookmark Topic Watch Topic
  • New Topic