[jboss-user] [EJB 3.0] - Re: ejbql - problem with like and named parameter
r_mun
do-not-reply at jboss.com
Tue Oct 17 05:03:41 EDT 2006
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 like
SELECT 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 like
q.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
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978721#3978721
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978721
More information about the jboss-user
mailing list