Welcome to the Hibernate community newsletter in which we share blog posts, forum, and StackOverflow questions that are especially relevant to our users.
Articles
The Okta developer blog published an article about using Hibernate with Spring Boot while also securing the application with OAuth 2.0.
Hibernate allows you to map the natural business key via the @NaturalId
annotation.
This article explains how to
expose the Hibernate-specific natural identifier API via the Spring Data Repository
contract.
If you need to map a given entity property to a JSON column, you can use the hibernate-types
project as it provides support for both String
and binary JSON column types. For more details about mapping a String
property to a JSON column, check out
this article.
If you’re using Hibernate with Spring Boot, this article explains various optimizations you can make to speed up application performance.
For our Korean readers, this article provides a list of resources you can use to learn more about Hibernate Performance Tuning.
When using JPA and Hibernate, you can call a database stored procedure using either
the JPA StoredProcedureQuery
or the Hibernate-specific ProcedureCall
.
This article
explains how the underlying CallableStatement
is handled by Hibernate and the best way to close the
associated JDBC resources as soon as possible.
The Lombok frameworks can generate the equals
, hashCode
and toString
methods on your behalf.
However, for JPA entities, there are several considerations to keep in mind, and
this article
explains you the best way to generate equals
and hashCode
with Lombok when using JPA and Hibernate.
To declare the transaction boundaries declaratively, you can use the @Transactional
annotation.
This article explains how the @Transactional
works in Spring and how to get the best out of it.
Questions and answers
-
Hibernate @OneToMany association with Lazy Loading and Cascade.ALL is fetched eagerly
-
Hibernate @ManyToMany with FetchMode.JOIN and FetchType.EAGER generates secondary queries
-
Polymorphic associations with Hibernate and Relational Database
-
Hibernate creating N+1 queries for @ManyToOne JPA annotated property
-
Hibernate performs N+1 selects instead of 1 query when using the Query Cache