How to test your JPQL / HQL without a Deploy

Hello, how are you?

Have you ever wanted to test your JPQL / HQL without doing a full deploy of your application?

What we will see here today is simple solution that works for any JPA implementation: Hibernate, OpenJPA, EclipseLink and others.

The base source code found in this post came from this book: “Pro JPA 2: Mastering the Java™ Persistence API – Mike Keith, Merrick Schincariol”. This post will add to the original code: query parameters and NamedQuery test.

The post contents:

  • Page 02: Model classes and data Generation
  • Page 03: Abstract test class
  • Page 04: Dynamic Query test
  • Page 05: NamedQuery test
  • Page 06: Running the application
  • Page 07: Using this post code with your application code
  • Page 08: Proposals

You will find the source code of this post in the last page.

In the page 07 you will see how to apply the code of this post to the code of your application.

2 thoughts on “How to test your JPQL / HQL without a Deploy

Leave a Comment