no

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 ...

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: http://www.querydsl.com/static/querydsl/4.1.3/reference/html_single/

Follow this guide to setup your project:
http://czetsuya-tech.blogspot.com/2017/04/how-to-setup-arquillian-testing-with.html
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: https://github.com/czetsuya/JavaEE7-QueryDSL-Demo

Things you should take notice:
  • In resources I have added a JPAQueryFactoryProducer:
    @Produces
     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.

Related

javaee 2315759598515103965

Post a Comment Default Comments

item