Introduction Now that I covered both Entity and Collection caching, it’s time to investigate how Query Caching works. The Query Cache is strictly related to Entities and it draws an association between a search criteria and the Entities fulfilling that specific query filter. Like other Hibernate features, the Query Cache is not as trivial as one might think. Entity model ...
Read More »Home » JBoss Hibernate »
NoSQL with Hibernate OGM – Part three: Building a REST application on WildFly
Welcome back to our tutorial series “NoSQL with Hibernate OGM”! Thanks to Gunnar Morling (@gunnarmorling) for creating this tutorial. In this part you will learn how to use Hibernate OGM from within a Java EE application running on the WildFly server. Using the entity model you already know from the previous parts of this tutorial, we will build a small ...
Read More »Custom Boolean User Type with Hibernate JPA
The ANSI SQL 1999 standard introduced a BOOLEAN data type (although unfortunately only as an optional feature). But to date it still isn’t implemented by most major database systems. As a consequence boolean columns are implemented in various ways. E.g., CHAR columns containing ‘Y’ or ‘N’, or using BIT columns. Subsequently, there is no way for JPA to provide a ...
Read More »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. Write-through caching NONSTRICT_READ_WRITE is a read-through caching strategy and updates end-up invalidating cache entries. As simple as this strategy may be, the performance drops with the increase of write operations. A write-through cache ...
Read More »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. Inner workings When the Hibernate transaction is committed, the following sequence of operations is executed: First, the cache ...
Read More »How does Hibernate Collection Cache work
Introduction Previously, I described the second-level cache entry structure, Hibernate uses for storing entities. Besides entities, Hibernate can also store entity associations and this article will unravel the inner workings of collection caching. Domain model For the up-coming tests we are going to use the following entity model: A Repository has a collection of Commit entities: @org.hibernate.annotations.Cache( ...
Read More »How to optimize Hibernate EllementCollection statements
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 ...
Read More »How does Hibernate READ_ONLY CacheConcurrencyStrategy work
Introduction As I previously explained, enterprise caching requires diligence. Because data is duplicated between the database (system of record) and the caching layer, we need to make sure the two separate data sources don’t drift apart. If the cached data is immutable (neither the database nor the cache are able modify it), we can safely cache it without worrying of ...
Read More »jOOQ Tuesdays: Vlad Mihalcea Gives Deep Insight into SQL and Hibernate
Welcome to the jOOQ Tuesdays series. In this series, we’ll publish an article on the third Tuesday every other month where we interview someone we find exciting in our industry from a jOOQ perspective. This includes people who work with SQL, Java, Open Source, and a variety of other related topics. We have the pleasure of talking to Vlad Mihalcea ...
Read More »