Hi I am new to JPA Criteria builder concept, I am using PostgreSQL and JPA Query.I got this query SELECT id, full_name, email FROM nurses WHERE(lower(sender) LIKE '%bar%' and lower(receiver) LIKE '%bar%').but how to convert it to JPA Criteria builder.
entityManager.getTransaction().begin();
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
System.out.println(entityManager + " Conected");
CriteriaQuery<sourceTracking> cq = cb.createQuery(sourceTracking.class);
Root<sourceTracking> data1 = cq.from(sourceTracking.class);
cq.where(cb.like(data1.<String>get("sender"), "%"+sender+"%"),cb.like(data1.<String>get("receiver"), "%"+receiver+"%");
cq.select(data1);
TypedQuery<sourceTracking> tquery = entityManager.createQuery(cq);
sourselList = tquery.getResultList();