How to integrate querydsl in your javaee7 project

This guide requires knowledge on:
  • maven
  • git
  • eclipse
  • querydsl
  • wild fly
We will show you how to modify the javaee7-archetype project to integrate querydsl. For those who do not know, it is a library to unify queries in java. What I like more about it is that you can fluently construct your api. For more info refer to:

Follow this guide to setup your project:
Take note, of the arquillian configuration, as we will need it later.

Since I am lazy :-), I will just provide the test project that I have created in GitHub:

Things you should take notice:
  • In resources I have added a JPAQueryFactoryProducer:
     public JPAQueryFactory produceJPQQueryFactory() {
      return new JPAQueryFactory(em);
  • Note that I have modified Member entity, added a BaseEntity and Identifiable interface.
  • I have added a new package: com.broodcamp.javaee_querydsl_demo.repository and the classes inside it.
  • I have also modified: MemberRegistrationTest, so that we can run the arquillian test correct.
To run arquillian simply execute this command inside your project in the terminal:
>mvn clean test -Parq-wildfly-managed

The test should run without error.
How to integrate querydsl in your javaee7 project How to integrate querydsl in your javaee7 project Reviewed by Edward Legaspi on Sunday, April 16, 2017 Rating: 5

No comments:

Powered by Blogger.