• 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
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

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
 
machines help you to do more, but experience less. Experience this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic