Easy criteria is a tool that will help any developer to create a JPA Criteria without  the verbose JPA Criteria default code!

Want to see how easy? Check the JPQL bellow:

select p from Person p

If you want to write a JPA Criteria that would do the same of the JPQL above, you would have something like:

CriteriaQuery<Person> criteriaQuery = criteriaBuilder.createQuery(Person.class);
Root<Person> root = criteriaQuery.from(Person.class);
TypedQuery<Person> query = entityManager.createQuery(criteriaQuery);

Too much code for a simple task, right?

Take a look below how you could do the same criteria using EasyCriteria:

EasyCriteria<Person> easyCriteria = EasyCriteriaFactory.createQueryCriteria(entityManager, Person.class);

Really hard, don’t you think? ;)

To use it with Maven, just add the dependency below: