Its good to solve your own problems some times. I manage to do it after banging my head on Laptop few times.
Code:
@NamedQuery(name = "Supplier.findBySupplierNameLike", query = "SELECT s FROM Supplier s WHERE s.clientId = :clientId and lower(s.name) like lower(concat(:name, '%'))") })
@Override
public List<Supplier> getSuppliersBySupplierNameLike(Integer clientId, String supplierName) {
em.getTransaction().begin();
@SuppressWarnings("unchecked")
List<Supplier> sups = em.createNamedQuery("Supplier.findBySupplierNameLike")
.setParameter("clientId", clientId).setParameter("name",supplierName).getResultList();
em.getTransaction().commit();
return sups;
}