![]()
Creating a wildcard query in Hibernate (HQL) is similar to how SQL handles the same funciton. The query is accomplished by using the, like keyword.
The example below searches for people with a name that contains Mik – an obvious match would be Mike.
Query query
= getEntityManager().createQuery("SELECT p FROM Person p WHERE p.name like :name");
query.setParameter("name", 'Mik");
query.getResultList(); // Returns a list of People.
