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); criteriaQuery.select(root); TypedQuery<Person> query = entityManager.createQuery(criteriaQuery); query.getResultList();
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); easyCriteria.getResultList();
Really hard, don’t you think?
To use it with Maven, just add the dependency below:
<dependency> <groupId>uaihebert.com</groupId> <artifactId>EasyCriteria</artifactId> <version>2.1.0</version> </dependency>