Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Richard Green
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

input parameters CANNOT be used in LIKE expression.


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

 
Ugender Rekulampally
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • 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
 
Chandra Sagi
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic