|

My new Hibernate Performance Tuning Online Training – Secure your early bird discount

If you are implementing Java applications which store data in a database, the chances are pretty high that you are using Hibernate. And as you are reading this post, the chances are even higher 😉 Hibernate is by far the most popular JPA implementation and there are good reasons for it. Implementing the basic database access with Hibernate…

How to define named queries at runtime with JPA 2.1
| |

How to define named queries at runtime with JPA 2.1

Defining a static named query via the @NamedQuery annotation is the most common way in JPA. It has the main advantage that the persistence provider can compile and validate the query at start-up time. But you also have to define the query statically at compile time. OK, you can still define a dynamic query at runtime but how do you…

Create type-safe queries with the JPA static metamodel
|

Create type-safe queries with the JPA static metamodel

When you write a criteria query or create a dynamic entity graph, you need to reference the entity classes and their attributes. The quickest and easiest way is to provide the required names as Strings. But this has several drawbacks, e.g. you have to remember or look-up all the names of the entity attributes when you write the query….