Showing entries 1 to 2
Displaying posts with tag: JPQL (reset)
Why, When and How to Use DTO Projections with JPA and Hibernate

The post Why, When and How to Use DTO Projections with JPA and Hibernate appeared first on Thoughts on Java.

DTOs are easy to use and the most efficient projection for read-only operations. So, whenever you don’t need to change the requested information, you should prefer a DTO projection.

But what exactly is a DTO? How does such a projection work with Hibernate? And how can you use it in your queries?

I will answer all of these questions in this article. And I will even show you a way to use a DTO projection that doesn’t require a custom DTO class.

DTO Projections with …

[Read more]
The best way to use SQL functions in JPQL or Criteria API queries with JPA and Hibernate

Introduction When executing an entity query (e.g. JPQL, HQL or Criteria API), you can use any SQL function without having to register it as long as the function is passed directly to the WHERE clause of the underlying SQL statement. However, if the SQL function is used in the SELECT clause, and Hibernate has not … Continue reading The best way to use SQL functions in JPQL or Criteria API queries with JPA and Hibernate →

The post The best way to use SQL functions in JPQL or Criteria API queries with JPA and Hibernate appeared first on Vlad Mihalcea.

Showing entries 1 to 2