Hi folks!
 
Using EJB ql it is possible define template queries such as
 
SELECT OBJECT(p) FROM Product p where p.name = ?1
 
Now - what I'm trying to achieve is the following:
The query should not only return exact matches but products whose name contains a given search string as well.
My approach looks like this:
 
SELECT OBJECT(p) FROM Product p where p.name LIKE concat(concat('%', ?1), '%')
 
JBoss doesn't accept this because it expects a String literal following the LIKE keyword.
Even the stripped down version doesn't work:
 
SELECT OBJECT(p) FROM Product p where p.name LIKE ?1
 
It seems to me that EJB QL only accepts constants following a LIKE statement.
Is there any way to achieve this kind of task using EJB QL. If not - what other approaches might work in this context?
 
thanks in advance

Reply via email to