Create better Criteria queries with Blaze persistence

Create better Criteria queries with Blaze persistence

The Blaze Persistence project provides an interesting alternative to JPA’s Criteria API. Both APIs enable you to define queries dynamically at runtime. Most developers use it to create query statements based on user input or the result of a business operation. Unfortunately, JPA’s Criteria API isn’t very popular because it’s hard to read and write….

Hibernate-specific extensions to the Criteria API
|

Hibernate-specific extensions to the Criteria API

Most developers know that the JPA specification defines the string-based JPQL query language and that Hibernate extends it to support things like database-specific functions, window functions, and set-based operations. But most developers don’t know that since version 6, Hibernate has done the same for JPA’s Criteria API. Extending an API is, of course, a little more complex…

Hibernate’s ResultTransformer in Hibernate 4, 5 & 6
| | |

Hibernate’s ResultTransformer in Hibernate 4, 5 & 6

Hibernate implements JPA’s standardized constructor expressions and @SqlResultSetMappings to map the results of your queries. And it also supports proprietary ResultTransformers. They provide a powerful and flexible way to map the result of your JPQL, Criteria, and native SQL query to a specific object structure. This can be entity or DTO objects, java.util.List or java.util.Map…

MutationQuery and SelectionQuery in Hibernate 6
|

MutationQuery and SelectionQuery in Hibernate 6

One of the smaller changes in Hibernate 6 that can easily get overlooked, which Steve Ebersole presented in a recent Expert Session in the Persistence Hub, is the introduction of the MutationQuery and SelectionQuery interfaces. It allows the separation between queries that change data and the ones that select it from the database. Older Hibernate…