SQL Server JDBC – Set sendStringParametersAsUnicode to false

Introduction In this article, I’m going to explain why you should always disable the sendStringParametersAsUnicode default JDBC Driver setting when using SQL Server.

A beginner’s guide to JPA persistence.xml file

Introduction In this article, I’m going to explain what is the purpose of the JPA persistence.xml configuration file, and how you can set up a Java Persistence application using the available XML tags or attributes. While Spring applications can bootstrap without needing an XML JPA configuration file, it’s still important to understand the meaning of each configuration option since Spring also offers an alternative way when building a Java Persistence LocalContainerEntityManagerFactoryBean or the Hibernate-specific LocalSessionFactoryBean.

How to detect HHH000104 issues with hibernate.query.fail_on_pagination_over_collection_fetch

Introduction Recently, I noticed the hibernate.query.fail_on_pagination_over_collection_fetch configuration property that was introduced in Hibernate 5.2, and I had absolutely no idea it can be used to prevent the HHH000104 Hibernate issues. As previously explained, if you want to overcome the “HHH000104: firstResult/maxResults specified with collection fetch; applying in memory!” issue, you have to either use 2 queries or a window function to fetch and limit the number of parent records while making sure you always fetch all their associated child entities. Even if the HHH000104 issue is logged as a warning message, it… Read More

How to customize the Hypersistence Utils JSON Serializer

Introduction The Hypersistence Utils open-source project allows you to map JSON, ARRAY, and PostgreSQL ENUM types and provides a simple way of adding immutable Hibernate Types. After adding support for customizing the Jackson ObjectMapper, the next most-wanted issue was to provide a way to customize the JSON serializing mechanism. In this article, you are going to see how you can customize the JSON serializer used by the JSON Types.

How to customize the Hypersistence Utils Jackson ObjectMapper

Introduction The Hypersistence Utils open-source project allows you to map JSON, and ARRAY when using JPA and Hibernate. Since I launched this project, one of the most wanted features was to add support for customizing the underlying Jackson ObjectMapper, and since version 2.1.1, this can be done either declaratively or programmatically. In this article, you are going to see how to customize the ObjectMapper when using the Hypersistence Utils project.