File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes EJB-QL input parameters CANNOT be used in LIKE expression. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "EJB-QL input parameters CANNOT be used in LIKE expression." Watch "EJB-QL input parameters CANNOT be used in LIKE expression." New topic
Author

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

Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536

input parameters CANNOT be used in LIKE expression.


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



MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Ugender Rekulampally
Ranch Hand

Joined: Nov 14, 2005
Posts: 130
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

Joined: May 05, 2005
Posts: 162
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

Joined: Nov 14, 2005
Posts: 130
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

Joined: Jul 17, 2006
Posts: 387
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

Joined: Aug 25, 2005
Posts: 536
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

Joined: Jul 17, 2006
Posts: 387
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB-QL input parameters CANNOT be used in LIKE expression.