• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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
 
Do the next thing next. That’s a pretty good rule. Read the tiny ad, that’s a pretty good rule, too.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic