Using JPA and Hibernate, you can choose between various ways to query your data, and each of them supports one or more kinds of projections. That provides you with lots of options to implement your persistence layer. But which one fits your use case? And which one should you avoid if you want to optimize your persistence layer for performance?
To answer these questions, we need to talk about the different ways to define a query. One of them is JPQL, of course. It’s a query language based on your domain model. But you can also use multiple proprietary and standardized APIs to create a query. Or you can execute native SQL queries if you need to use database-specific query features or define very complex queries.
In this video, I will explain when you should use which approach to using optimal query approach and projection.
If you are new here and you want to learn how to create your entity mappings with ease, build incredible efficient persistence layers with Hibernate and all types of other Java persistence related stuff, start now by subscribing and clicking the bell, so you don’t miss anything.
And if you have any topic or question related to Hibernate that you want to learn more about, please share it in the comment section below
If you like this video, please give me your thumbs up and share it with your friends and co-workers.
Links mentioned in the video-
• Basic SQL ResultSet Mappings : https://thoughts-on-java.org/result-set-mapping-basics/
• Complex SQL ResultSet Mappings : https://thoughts-on-java.org/result-set-mapping-complex-mappings/
• Mapping DTO Projections : https://thoughts-on-java.org/result-set-mapping-constructor-result-mappings/
• Hibernate-specific Mappings : https://thoughts-on-java.org/result-set-mapping-hibernate-specific-mappings/
• How to select multiple scalar values in a Criteria Query : https://thoughts-on-java.org/hibernate-tips-select-multiple-scalar-values-criteria-query/
• Entities or DTOs – When should you use which projection? : https://thoughts-on-java.org/entities-dtos-use-projection/
• Native Queries – How to call native SQL queries with JPA & Hibernate : https://thoughts-on-java.org/jpa-native-queries/
Like my channel? Subscribe!
Join the free Member Library:
Read the accompanying post: https://thoughts-on-java.org/optimal-query-and-projection-jpa-hibernate/
Want to connect with me?
#hibernate #JPA #Projection #OptimalQueryApproach
Youtube original link