How does Hibernate READ_WRITE CacheConcurrencyStrategy work

Introduction

In my previous post, I introduced the NONSTRICT_READ_WRITE second-level cache concurrency mechanism. In this article, I am going to continue this topic with the READ_WRITE strategy.

Continue reading “How does Hibernate READ_WRITE CacheConcurrencyStrategy work”

Advertisements

How does Hibernate NONSTRICT_READ_WRITE CacheConcurrencyStrategy work

Introduction

In my previous post, I introduced the READ_ONLY CacheConcurrencyStrategy, which is the obvious choice for immutable entity graphs. When cached data is changeable, we need to use a read-write caching strategy and this post will describe how NONSTRICT_READ_WRITE second-level cache works.

Continue reading “How does Hibernate NONSTRICT_READ_WRITE CacheConcurrencyStrategy work”

How to optimize unidirectional collections with JPA and Hibernate

Introduction

Hibernate supports three data mapping types: basic (e.g String, int), Embeddable and Entity. Most often, a database row is mapped to an Entity, each database column being associated to a basic attribute. Embeddable types are more common when combining several field mappings into a reusable group (the Embeddable being merged into the owning Entity mapping structure).

Both basic types and Embeddables can be associated to an Entity through the @ElementCollection, in a one-Entity-many-non-Entity relationship.

Although we are going to explain these optimizations using an @ElementCollection, the same rules apply to any unidirectional @OneToMany or to both unidirectional and bidirectional @ManyToMany associations.

Continue reading “How to optimize unidirectional collections with JPA and Hibernate”