The best way to do batch processing with JPA and Hibernate

Introduction Recently, one of my followers asked me to answer a question on Quora about batch processing, and, since the question was really interesting, I decided to turn it into a blog post. In this article, you are going to find out what batch processing is, why do we use it, and how to use it properly with JPA and Hibernate.

How does a JPA Proxy work and how to unproxy it with Hibernate

Introduction In this article, I’m going to explain how JPA and Hibernate Proxy objects work, and how you can unproxy an entity Proxy to get access to the underlying POJO instance. The JPA lazy loading mechanism can either be implemented using Proxies or Bytecode Enhancement so that calls to lazy associations can be intercepted and relationships initialized prior to returning the result back to the caller. Initially, in JPA 1.0, it was assumed that Proxies should not be a mandatory requirement, and that’s why @ManyToOne and @OneToOne associations use an EAGER loading… Read More

How do PostgreSQL advisory locks work

Introduction PostgreSQL, like many modern RDBMS, offers both MVCC (Multi-Version Concurrency Control) and explicit pessimistic locking for various use cases when you want a custom concurrency control mechanism. However, PostgreSQL also offers advisory locks which are very convenient to implement application-level concurrency control patterns. In this article, we are going to explain how PostgreSQL advisory locks work and how you should use them.

How to get started with CockroachDB

Introduction CockroachDB is a really interesting database system, getting the best of both RDBMS and NoSQL. It’s been developed by former Google developers, and it’s inspired by Google Spanner. However, unlike Google Spanner, which is offered as a service in Google Cloud, CockroachDB is an open-source database that can be installed on premise. Also, CockroackDB allows you to use the PostgreSQL drivers as opposed to Spanner which only supports the gRPC protocol. So, you can practically reuse all the frameworks that have emerged in the Java ecosystem like connection pools, monitoring proxies… Read More

2 best tools that can help you solve ANY software development problem

Introduction You read it correctly. Any is a very broad term. However, these two tools that I’m going to talk about in this article allow me to solve any software development problem across a very broad range of skills.

Why you should use the Hibernate ResultTransformer to customize result set mappings

Introduction JPA queries allow you to fetch either entities or DTO projections. However, sometimes you want a combined result set as illustrated in this Hibernate forum question.