Auditing with JPA, Hibernate, and Spring Data JPA 1. Overview In the context of ORM, database auditing means tracking and logging events related to persistent entities, or simply entity versioning. Inspired by SQL triggers, the events are insert, update and delete operations on entities. The benefits of database auditing are… Continue Reading database-auditing-jpa

Use Criteria Queries in a Spring Data Application 1. Introduction Spring Data JPA provides many ways to deal with entities including query methods and custom JPQL queries. However, sometimes we need a more programmatic approach: for example Criteria API or QueryDSL. Criteria API offers a programmatic way to create typed… Continue Reading spring-data-criteria-queries

Difference Between @JoinColumn and mappedBy 1. Introduction JPA Relationships can be either unidirectional or bidirectional. It simply means we can model them as an attribute on exactly one of the associated entities or both. Defining the direction of the relationship between entities has no impact on the database mapping. It… Continue Reading jpa-joincolumn-vs-mappedby

REST Query Language with Spring and JPA Criteria 1. Overview In this first article of this new series, we’ll explore a simple query language for a REST API. We’ll make good use of Spring for the REST API and JPA 2 Criteria for the persistence aspects. Why a query language?… Continue Reading rest-search-language-spring-jpa-criteria