Welcome to the Hibernate community newsletter in which we share blog posts, forum, and StackOverflow questions that are especially relevant to our users.
Articles
Valentin Kovalenko wrote a very good summary of why it would be worth to pass the IN query clause parameters using an ARRAY and a single bind parameter value. This functionality is not yet implemented in Hibernate, but we should definitely investigate it for Hibernate ORM 6.
The JPA EntityManager
exposes the persist
and merge
methods if you want to insert an entity or to update it after it was changed in the detached state. However, Hibernate offers three additional methods (save
, update
, and saveOrUpdate
) which can also be used to trigger an INSERT or UPDATE statement.
This article explains the difference between persist
, merge
, save
, update
, and saveOrUpdate
.
If you want to learn how to executes aggregate queries using JPQL, then this article gives you a short introduction to this topic.
This article explains how to map a java.time.Year
using a JPA AttributeConverter
. If you want to use a Hibernate Type, or if you want to map java.time.Month
or java.time.YearMonth
, then check out
this article.
If you using Spring Boot, this article explains how to customize the Hibernate naming strategies.
Logging the current database transaction identifier is a very useful feature when you want to aggregate all log messages that belong to the same database transaction. This article introduces the MDC (Mapped Diagnostic Context) feature supported by many Java logging solutions and which allows you to pass variables programmatically to log entries.
Questions and answers
-
Hibernate with EAGER loading issues two queries instead of one
-
Calling clear on a JPA entity property using AccessType.PROPERTY fails
-
How to query by custom object entity property with JPA and Hibernate
-
What are the differences between the different saving methods in Hibernate?
-
What is the main and most important between save and saveOrUpdate method in Hibernate?
-
Delete child from parent and parent from child automatically with JPA annotations
-
How to get a single instance for an associated read-only entity with JPA and Hibernate?
-
The Hibernate SessionFactory is always null when using Spring dependency injection
-
What is the role of mappedBy in JPA or inverse="true" in Hibernate?