How do i do a like statement in ejb-ql?

1.8k Views Asked by At

Possible Duplicate:
Parameter in like clause JPQL

I got this code from an example, how do i do a search with ebj ql?

SELECT OBJECT(p)
FROM Person p
WHERE (p.name LIKE ?1)

How do i continue from here? I would like to return results where p.name contains string "test"

1

There are 1 best solutions below

0
Slay On

i found the solution. here is an example.

Query query = em.createQuery("SELECT c FROM TestEntity c WHERE   c.titleLIKE :searchString");
query.setParameter("searchString", "%" + "test" + "%");