This content has been marked as final.
Show 1 reply
-
1. Re: ejbql - problem with like and named parameter
r_mun Oct 17, 2006 5:03 AM (in response to adamzrk)Hi, Adam
I have faced the same problem. You have probably found the sollution youself.
Just for the protocol I'll add my sollution to this problem so that others could use it.
The query I formed was likeSELECT distinct object(o) FROM Rental o WHERE lower (o.description) LIKE lower('%:fullTextSearch%')
later in the code an attribute was set via (q is a an EJB3 Query object)q.setParameter("fullTextSearch", aSubStringToSearchFor);
After playing with parameters and code I finally did the following changes that fixed the issue.SELECT distinct object(o) FROM Rental o WHERE lower (o.description) LIKE lower(:fullTextSearch)
and the attribute setter likeq.setParameter("fullTextSearch", "%" + aSubStringToSearchFor + "%");
The problem is obviously that Hibernate is not capable of setting a parameter within single-quoted statements.
Regards,
Roman Muntyanu
http://www.yukon.cv.ua