filmov
tv
Fetching A DTO Projection with a To Many Association

Показать описание
DTO projections provide better performance than entities if you only want to read but not change the retrieved information. They avoid the management overhead of an entity class and enable you to only select the database columns your business code needs.
But as so often, DTO projections also have a downside, and that’s the handling of associations. When you select an entity object, you can easily traverse all of its managed associations. Doing that with a DTO projection requires a custom result mapping.
The JPA specification defines a constructor expression for JPQL queries, which gets executed for each record in the result set and doesn’t support nested constructor calls. That’s more than good enough to map your query result to a flat data structure. But you can’t map a query result that consists of multiple records to a DTO object that contains a list of other complex objects.
This video will show you the best way to map such a query result programmatically and how to use Hibernate’s ResultTransformer to let Hibernate handle the result.
Like my channel? Subscribe!
Links mentioned in the video:
Want to connect with me?
Fetching A DTO Projection with a To Many Association
The best way to fetch SQL query projections with JPA
JPA & Hibernate - Why, When & How to use DTO Projections
How to Return DTOs from Native Queries with Spring Data JPA
Spring Boot tutorials | Spring Data JPA - Projections using Spring Data JPA with DTO as interfaces
Spring Data JPA Entity, DTO e Projection
Avoid writing custom DTO mapping with JPA Open Projections
Spring Data JPA: Query Projections
Spring Data JPA Projections
Projections with JPA and Hibernate
Spring Boot - Database: 8.5.15 JPQL - @NamedQuery - Projection - Object[] to DTO
Spring Boot + Kubernetes Tutorial Series - Part 5 : Using Spring Data JPA DTO Projections
Spring Boot - Database: 8.5.7 JPQL - @Query - Projection - DTO - Interface - Child
JPA & Hibernate: Using the Optimal Query Approach & Projection
Spring Boot - Database: 8.5.19 JPQL - createQuery() - Projection - Object[] to DT
How to use Spring Data Dynamic Projection | JPA Buddy
Part 17 Spring Data Record/DTO Projections
How to generate Spring Data JPA Projections | JPA Buddy
Hibernate Tip: The best way to work with scalar projections
How to Write DTO Projection Queries for Enums and Map Them to String in Spring Boot JPA
How to use Spring Data JPA Projection basic example
Part 10 Spring Data Projections
Spring Boot tutorials | Spring Data JPA - Projections using Spring Data JPA with DTO as classes
Dynamic projections with Spring Data JPA
Комментарии