Introduction In this article, I’m going to explain how we can map Java Records to JSON columns when using Hibernate. Because Hibernate ORM does not offer built-in support for JSON, we are going to use the Hiberate Types library, which allows you to map entity attributes to JSON column types, no matter if you are using Oracle, SQL Server, PostgreSQL, or MySQL.
Introduction In this article, I’m going to explain how the JPA and Hibernate first-level mechanism works and how it can improve the performance of your data access layer. In JPA terminology, the first-level cache is called Persistence Context, and it’s represented by the EntityManager interface. In Hibernate, the first-level cache is represented by the Session interface, which extends the JPA EntityManager one.
Introduction In this article, I’m going to explain how the Hibernate Session doWork and doReturningWork methods work, and when you should use them.
Introduction To ensure that your Spring Boot application fulfills the SLA (Service Level Agreement) requirements, you need a performance monitoring tool. In this article, I’m going to show you how you can monitor the data access layer of a Spring Boot application using Hypersistence Optimizer.
Introduction If you are wondering why and when you should use JPA or Hibernate, then this article is going to provide you an answer to this very common question. Because I’ve seen this question asked very often on the /r/java Reddit channel, I decided that it’s worth writing an in-depth answer about the strengths and weaknesses of JPA and Hibernate. Although JPA has been a standard since it was first released in 2006, it’s not the only way you can implement a data access layer using Java. We are going to discuss… Read More
Introduction In this article, we are going to see how the Hibernate hbm2ddl.auto schema generation tool works, and when it’s appropriate to use it.
Introduction In this article, we are going to see how we can encrypt and decrypt JSON properties when using JPA and Hibernate. While encrypting the entire column value is very straightforward, when it comes to JSON columns, we need to preserve the JSON object structure while only encrypting the JSON property values.
Introduction JPA and Hibernate allow us to execute bulk update and delete queries so that we can process multiple rows that match the business use case filtering criteria. When modifying multiple records, you have two options. You could either use batch processing or bulk processing. While batch processing is useful when entities are already managed by the current Persistence Context because it can reduce the number of INSERT, UPDATE, or DELETE statements that get executed, bulk processing allows us to modify the underlying database records with a single SQL statement.
Introduction In this article, we are going to see how the JPA AttributeConverter works and how we can use it to customize the entity attribute to the database column mapping. For instance, we could use a JPA AttributeConverter to map a Java MonthDay to a database DATE column because Hibernate doesn’t offer a built-in MonthDayType to handle this particular mapping.