0

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"

Community
  • 1
  • 1
Slay
  • 1,285
  • 4
  • 20
  • 44

1 Answers1

0

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" + "%");
Slay
  • 1,285
  • 4
  • 20
  • 44