How to encrypt and decrypt data with Hibernate

Introduction

Today, one of my Twitter followers sent me the following StackOverflow question, and, while answering it, I realized that it definitely deserves a post of its own.

In this post, I will explain how you can encrypt and decrypt data with Hibernate.

Continue reading “How to encrypt and decrypt data with Hibernate”

Advertisements

How to map the latest child of a parent entity using Hibernate @JoinFormula

Introduction

Today, I stumbled upon a StackOverflow answer that I gave some time ago and realized that it deserves a post of its own.

As previously explained, the @JoinForuma is a very awesome annotation which allows you to customize the way you join entities beyond JPA @JoinColumn capabilities.

Continue reading “How to map the latest child of a parent entity using Hibernate @JoinFormula”

How to replace the TABLE identifier generator with either SEQUENCE or IDENTITY in a portable way

Introduction

As previously explained, the TABLE identifier generator does not scale, so you should avoid id. However, some enterprise applications might need to run on both MySQL (which does not support database sequences), as well as Oracle, PostgreSQL and SQL Server 2012.

This is article is going to explain how easily you can achieve this goal using the JPA mapping overriding.

Continue reading “How to replace the TABLE identifier generator with either SEQUENCE or IDENTITY in a portable way”