Skip to content

(Under development) This is a tool that helps you create queries with Hibernate using JPQL or native SQL

License

Notifications You must be signed in to change notification settings

AndersonCRocha/jpql-query-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 Cannot retrieve latest commit at this time.

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Query Builder JPQL for JPA Queries (Under development)

This is a tool that helps you create queries with JPA using JPQL or native SQL

How to install

Using Maven

Add this dependency in your pom.xml

<dependency>
  <groupId>io.github.andersoncrocha</groupId>
  <artifactId>jpql-query-builder</artifactId>
  <version>1.2.2</version>
</dependency>

Or download the jar of the lib

jpql-query-builder.jar

How to use

Examples

public List<Order> findOrdersWithItemsByClientAndSellerIfNotNull(Client client, Seller seller) {
  return new QueryBuilder(entityManager)
    .from(Order.class, "order")
    .joinFetch("order.items")
    .where("order.client = :client", client)
    .whereIf("order.seller = :seller", seller, Objects.nonNull(seller))
    .getResultList(Order.class);
}

About

(Under development) This is a tool that helps you create queries with Hibernate using JPQL or native SQL

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages