JPA & Hibernate - Why, When & How to use DTO Projections

  Рет қаралды 16,600

Thorben Janssen

Thorben Janssen

Күн бұрын

Пікірлер
@Serhiy-Nechosov
@Serhiy-Nechosov 3 жыл бұрын
Good day, everyone!!! Thank you very much, very needed information
@Quester82
@Quester82 2 жыл бұрын
Is there an out of the box way to create such a projection with nested fields like, for example, List items; ? And if here is no way to do that what do you suggest to do when you actually need to build such a projection?
@TimoSurfs
@TimoSurfs 3 жыл бұрын
Incredibly helpful video!
@MrMikomi
@MrMikomi 3 жыл бұрын
Hi, how can we verify that Dto projections are more performative than eg entity projections? Thanks.
@ajayuyyala338
@ajayuyyala338 3 жыл бұрын
Much needed information. Do they support nested DTO projection? Like objects with collection objects.
@Thorben-Janssen
@Thorben-Janssen 3 жыл бұрын
Hi Ajay, No, there is no support for nested DTO projections. You could add a constructor to your top-level class and instantiate the nested DTO objects in there. But please keep in mind that Hibernate applies the constructor to each record in the result set as the database returns it. This result set is a flat data structure. You can't access the full list of a to-many association in the constructor because the database returns it as author1-book1, author1-book2, author1-book3, ...
@ajayuyyala338
@ajayuyyala338 3 жыл бұрын
@@Thorben-Janssen thank you for the reply. Yes the result set is a flat data structure. My response format is a bit complex. I used the constructor to create a temporary response and converted it to my desired response format using mapstruct. Your blog has been very much useful. Thank you!
@rahulkhimasia
@rahulkhimasia 3 жыл бұрын
Very informative. Thanks.
@shubhamchauduary4492
@shubhamchauduary4492 2 жыл бұрын
@ThorbenJanssen How to use the nested DTO data Projection
@robertzdeb8103
@robertzdeb8103 3 жыл бұрын
Great stuff!
@ganeshvbidwe
@ganeshvbidwe 3 жыл бұрын
Hello Thorben Janssen, Please provide the entire source code
@tgf972
@tgf972 3 жыл бұрын
sympathisch
@richJinny
@richJinny 3 жыл бұрын
The Criteria API is awfull!
@Thorben-Janssen
@Thorben-Janssen 3 жыл бұрын
Haha, yes the Criteria API is special ;)
5 Hibernate Features You Should Use With Spring Data JPA
11:21
Thorben Janssen
Рет қаралды 5 М.
How to call native SQL queries with JPA and Hibernate
13:46
Thorben Janssen
Рет қаралды 4,7 М.
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН
JAVA DTO Pattern Tutorial | Simplify Your Code
19:12
Amigoscode
Рет қаралды 217 М.
Spring Data JPA: Query Projections
10:10
Thorben Janssen
Рет қаралды 19 М.
JPA & Hibernate: Basic Annotations You Need To Know
15:11
Thorben Janssen
Рет қаралды 32 М.
LazyInitializationException: What it is and the best way to fix it
9:57
Spring & Spring Data JPA: Managing Transactions
10:34
Thorben Janssen
Рет қаралды 66 М.
JPA & Hibernate: Using the Optimal Query Approach & Projection
11:13
Thorben Janssen
Рет қаралды 4,6 М.
How to choose the right FetchType to avoid Hibernate performance issues
9:41
Spring Data JPA: Ultimate Guide to Custom Queries with @Query Annotation
15:09
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН