Spring Data JPA Query By Example: Write 10x Less Code for Dynamic Searches

preview_player
Показать описание
Tired of writing endless custom repository methods for your Spring Boot applications? In this tutorial, I'll show you how Query By Example (QBE) can revolutionize the way you handle dynamic database searches. Whether you're building a search form with multiple filters or need flexible querying capabilities, QBE is about to become your new best friend! 🚀

In this comprehensive tutorial, we'll build a complete Spring Boot application that demonstrates the power of Query By Example. I'll walk you through every step, from basic setup to advanced implementation, showing you how to eliminate boilerplate code and create clean, maintainable search functionality.

What You'll Learn:
• How to implement Query By Example in Spring Data JPA
• Techniques for creating dynamic searches without custom repository methods
• Best practices for building flexible database queries
• Advanced QBE features like ExampleMatcher and custom matching rules
• Integration with PostgreSQL using Docker
• Real-world examples with employee data management

Video Chapters:
00:00 - Introduction & Overview
02:15 - Project Setup with Spring Boot
04:30 - Understanding Query By Example Basics
08:45 - Implementing Your First QBE Query
12:30 - Advanced Query Matching Techniques
16:20 - Working with Multiple Search Criteria
19:45 - Best Practices & When to Use QBE
23:15 - Demo: Building a Search API
27:30 - Testing Your Implementation
31:00 - Final Tips & Conclusion

🔨 Tools & Technologies Used:
• Spring Boot 3.3.5
• Java 23
• PostgreSQL
• Docker
• Maven
• Spring Data JPA

📚 Resources:

💬 Leave a comment below if you have any questions or suggestions for future tutorials!

👋🏻Connect with me:

Рекомендации по теме
Комментарии
Автор

Thanks, really time-saving tips, dumping cumber-some MyBatis for simple scenarios

yuzhenwang
Автор

Thanks Dan, I tried it and it's brillant.

korponaiz
Автор

Thanks a lot for this content! It's the first time I've seen this feature in use!

Jvnyor
Автор

Thanks, Dan. I will try that feature later.

isasubani
Автор

Thank you very much. Very useful video. Just what i need for the current task

SergeyKhaylov
Автор

Hi Dan
Love you videos, i keep watching various new and old ones from time to time.
Can you make a video about Liquibase and/or Flyway, how they are used, what problem they solve, implementation etc

Thanks

testChannel-gnjm
Автор

Thank you for your excellent tutorial videos! In this particular one, I was just wondering why you chose to use the POST method instead of GET.

MasoudSharghi-zn
Автор

Instead of passing an employee object in the controller or service class can I create a dto and just pass that instead and still be able to retrieve the employee class also

omotosoiyanu
Автор

Most rich people stay rich by spending like the poor and investing without stopping then most poor people stay poor by spending like the rich yet not investing like the rich but impressing them. People prefer to spend money on liabilities, Rather than investing in assets and be very profitable.

jbdbuilders
Автор

veri nice and easier that the query dsl

elhadjibrahimabalde
Автор

Does query by example mix the responsibilities of repository and service ?

RBCu
Автор

JpaRepository itself extends QBE Executor. So do you need to also extend it on your own repository interface?

GreggBolinger
Автор

Doesn’t JpaRepository extend QueryByExampleExecutor?

bizoitz
Автор

great video, one question: why dont you use lombok annotations for all the boilerplate code?

shshlomy
Автор

What is the theme name you are using ?

pavancb
Автор

would have been better if you would have compared Specification with QBE.use case of each

cutechinmoy
join shbcf.ru