How to call custom database functions with JPA and Hibernate
| |

How to call custom database functions with JPA and Hibernate

JPA supports a set of database functions which you can use to perform small operations and transformations within a query. This is often easier and faster than doing it in the Java code. But how do you call functions which are not supported by the JPA standard, like database-specific ones or the custom functions implemented…

|

Free Sample Lecture: Hibernate 1st Level Cache

I’m currently recording the Hibernate Performance Tuning Online Training and today I want to share the lecture about Hibernate’s 1st level cache with you. Hibernate activates the 1st level cache by default and uses it to optimize the performance of your application if you don’t prevent it. OK, you probably wonder why you should prevent Hibernate from using the cache…

| | |

Free Mini Course: How to find and fix n+1 select issues with Hibernate

Loading related entities with JPA and Hibernate is a comfortable feature that is also the most common reason for performance issues. In most applications you can find one of these two issues: related entities are eagerly loaded, even if they are not needed or related entities are lazily loaded which creates n+1 select issues if…

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…