Home

Awesome

uaiCriteria

How can JPA criteria became easier?

CodeStatus ---> Build Status Coverage Status Maven Central

Yes, your JPA Criteria can be easy. All you need to do is to add uaiCriteria in your implementation.

Imagine that you want to run the following JPQL:

select p from Person p 

If you want do write the JPQL above using only the JPA native Criteira, you should do 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();

With uaiCriteria you could run like this:

UaiCriteria<Person> easyCriteria = UaiCriteriaFactory.createQueryCriteria(entityManager, Person.class);
uaiCriteria.getResultList();

To create a code like the code above, add the maven dependency below:

<dependency>
    <groupId>uaihebert.com</groupId>
    <artifactId>uaiCriteria</artifactId>
    <version>4.0.0</version>
</dependency>

Now, criteria is easy to use! ;)

You have the following mvn commands available: