Introduction In this article, I’m going to explain what CDC (Change Data Capture) is, and why you should use it to extract database row-level changes. In OLTP (Online Transaction Processing) systems, data is accessed and changed concurrently by multiple transactions, and the database changes from one consistent state to another. An OLTP system always shows the latest state of our data, therefore facilitating the development of front-end applications that require near real-time data consistency guarantees. However, an OLTP system is no island, being just a small part of a larger system that… Read More
Introduction Now that the JPA 2.2 Review Ballot was approved let’s start analyzing some of the new additions to the standard which have been supported by Hibernate for quite some time already. In this article, we are going to see how JPA 2.2 Date/Time works, and which types you need to use depending on your business case requirements.
Introduction In this article, we are going to see how you can map SQL arrays to JPA entity attributes when using Hibernate. Hibernate custom Types allow you to map all sorts of database-specific column types, like IP address, JSON columns, bit sets, or SQL arrays. However, while you can create your own custom Hibernate Types, for mapping PostgreSQL arrays, you don’t need to implement your own Hibernate Type. All you need to do is use the Hibernate Types open-source project.
Introduction As previously explained, the SINGLE_TABLE inheritance is the most efficient entity inheritance strategy. However, for JPQL query such as this one: Hibernate generates a SQL query which filters by the associated discriminator column (e.g. DTYPE by default): So, because we are filtering by the discriminator column, we might want to index it or include it to speed up queries. However, the default STRING DiscriminatorType expects a VARCHAR column that must hold the longest entity subclass name. For the Announcement class, we need at least 12 bytes to store the entity class… Read More
Introduction Recently, my friend Lukas Eder wrote the following message on Twitter: Just like in any OOP (Object-Oriented Programming) language, entity inheritance is suitable for varying behavior rather than reusing data structures, for which we could use composition. The Domain Model compromising both data (e.g. persisted entities) and behavior (business logic), we can still make use of inheritance for implementing a behavioral software design pattern. In this article, I’m going to demonstrate how to use JPA inheritance as a means to implement the Strategy design pattern.