The post Hibernate Performance Tuning – 2025 Edition appeared first on Thorben Janssen. Based on most discussions online and at conferences, there seem to be 2 kinds of projects that use Hibernate for their persistence layer: So, what’s the difference between these projects? Are the projects in the 2nd group more complex or have higher performance requirements? No, based on my consulting projects, that’s not the case. On... The post Hibernate Performance Tuning – 2025 Edition appeared...| Thorben Janssen
The post Date and Time Mappings with Hibernate and JPA appeared first on Thorben Janssen. Databases support various data types to store date and time information. The most commonly used ones are: You can map all of them with JPA and Hibernate. But you need to decide to which Java type you want to map your database column. The Java language supports a bunch of classes to represent date and... The post Date and Time Mappings with Hibernate and JPA appeared first on Thorben Janssen.| Thorben Janssen
The post Should your tests manage transactions? appeared first on Thorben Janssen. During my Spring Data JPA workshops and talks, I often get asked if a test case should handle transactions, or not. And if it handles the transaction if it should commit it or roll it back. And as so often, the short answer is: it depends. The slightly longer answer is: it depends on the... The post Should your tests manage transactions? appeared first on Thorben Janssen.| Thorben Janssen
The post Databases and AI with Neo4J as an example with Michael Simons appeared first on Thorben Janssen. When integrating AI into your application, you will most likely want to use a concept called RAG. This acronym stands for Retrieval Augmented Generation and is an absolute game changer. The idea is simple: By providing your own input data to your LLM, you can improve the quality of its response and let it include... The post Databases and AI with Neo4J as an example with Michael Simons ap...| Thorben Janssen
The post Implement your primary key as a Record using an IdClass appeared first on Thorben Janssen. There are various reasons to implement your own primary key representation. Your primary key may consist of multiple attributes. Or you’re following domain-driven design principles and want to use a custom type to add semantic meaning to it. Implementing a record and mapping it as an IdClass seems evident in these situations. A record is efficient, easy to implement, immutable... The pos...| Thorben Janssen
My personal review of DuckDB in Action: Read this book if you want to learn about DuckDB or are looking for new ways to transform data from different sources.| Thorben Janssen
Grow your Java persistence skillsin less than 10 minutes a day! Join 10k+ developers to get a persistence tip every weekday.Get some of my best cheat sheets and ebooks for free. I will collect, use and protect your data in accordance with my privacy policy. Bring your Java persistence skills to the next level. Here’s how...| Thorben Janssen
The LocalDate and LocalDateTime classes are not supported by JPA and Hibernate. This can be changed by implementing an attribute converter for them.| Thorben Janssen
All you need to know to execute native SQL statements with Hibernate, handle the query result and avoid common performance pitfalls.| Thorben Janssen
As expected, the recent release of the JPA 2.2 specification introduced official support for some of the classes of the Date and Time API. Before that, you had to rely on proprietary features, like the ones introduced in Hibernate 5, or you had to provide an AttributeConverter to implement the mapping. Let’s take a closer...| Thorben Janssen
How should you configure your Hibernate logging to find performance issues during development? What is the best configuration for production?| Thorben Janssen
How to use database sequences, tables and auto-incremented columns to generate primary key values with JPA and Hibernate.| Thorben Janssen
The entity lifecycle model is one of the core concepts of JPA. It defines if an entity gets loaded, if changes get persisted, and much more| Thorben Janssen
DTO projections are the most efficient ones for read operations. Let me show you how to use them in JPQL, Criteria and native queries. You can even use them without a DTO class| Thorben Janssen
JPQL allows you to define database queries based on your entity model. Learn how to use all its features to build powerful queries with JPA and Hibernate.| Thorben Janssen
Most Java developers encounter problems when learning how to integrate AI into their applications using SpringAI, Langchain4J, or some other library. AI introduces many new terms, acronyms, and techniques you must understand to build a good system. I ran into the same issue when I started learning about AI. In this article, I did my...| Thorben Janssen
Repositories are a commonly used pattern for persistence layers. They abstract from the underlying data store or persistence framework and hide the technical details from your business code. Using Jakarta Data, you can easily define such a repository as an interface, and you’ll get an implementation of it based on Jakarta Persistence or Jakarta NoSQL....| Thorben Janssen
Learn the most important concepts and start using your first Jakarta Data repository using Hibernate as your persistence provider.| Thorben Janssen
Easily map LocalDateTime, ZonedDateTime, and other Date and Time API classes with Hibernate. Here's everything you need to know| Thorben Janssen
FetchTypes define when Hibernate shall fetch associated entities from the database and are an important element for a high-performance persistence layer.| Thorben Janssen
Hibernate 6 introduced a huge improvement to the mapping of ZonedDateTime and OffsetDateTime.| Thorben Janssen
Define a custom base repository that fits the needs of your project and let Spring Data JPA provide the implementation.| Thorben Janssen
Hibernate 6 introduces support for records as embeddables. In 6.0 and 6.1, this still requires a custom instantiator. Starting with 6.2, Hibernate handles it automatically.| Thorben Janssen
PostgreSQL offers proprietary datatypes to store JSON documents which are not supported by Hibernate. But you can change that with a UserType.| Thorben Janssen