Mapping PostgreSQL Interval to Java Duration with Hibernate

Introduction In this article, we are going to see how to map the PostgreSQL interval column type to a Java Duration object using Hibernate and the hibernate-types project. Another very useful feature introduced by the hibernate-types project is that all types extending the ImmutableType can now be treated as standard org.hibernate.type.Type, therefore enabling a much better Hibernate Core API integration.

How to map multiple JPA entities to one database table with Hibernate

Introduction In this article, we are going to see how we can map multiple JPA entities to one table with Hibernate. Using multiple entities can speed up both read and write operations. This question has been a recurring theme on StackOverflow, so I decided to explain the advantages of mapping multiple JPA entities to the same database table.

How to limit the SQL query result set to Top-N rows only

Introduction In this article, we are going to see how we can limit the SQL query result set to the Top-N rows only. Limiting the SQL result set is very important when the underlying query could end up fetching a very large number of records, which can have a significant impact on application performance.

How to write JPA Criteria API queries using Codota

Introduction Writing JPA Criteria API queries is not very easy. The Codota IDE plugin can guide you on how to write such queries, which greatly simplifies the process. In this article, we are going to see how Codota works and how it can help you discover a given API.

Pagination best practices

Introduction In this article, we are going to discuss several data pagination best and worst practices. Data pagination is omnipresent in enterprise applications. Yet, most solutions, not only they offer a bad user experience, but they are also inefficient.