Spring Data JPA: Ultimate Guide to Custom Queries with @Query Annotation

preview_player
Показать описание
In this video, I will show you how to define and use custom queries with Spring Data JPA. You will learn how to execute JPQL and native queries, use an expression language in your queries and execute queries that INSERT, UPDATE, or REMOVE records.
But before we start, if this is your first time 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.
Derived queries are very comfortable to use as long as the queries are not too complicated. But as soon as you use more than 2-3 query parameters or need to define multiple joins to other entities, you need a more flexible approach. In these situations, you better use Spring Data JPA’s @Query annotation to specify a custom JPQL or native SQL query.

If you like this video, please give me your thumbs up and share it with your friends and co-workers.

Like my channel? Subscribe!

Join the free Member Library:

Want to connect with me?

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

Your instructions are clear and short👍. Thank you!

MsPrettygd
Автор

Your videos are really helpful. Thank you very much.

isurangaediriweera
Автор

Best videos about JPA- thanks for making them!!

DreamingWithEyesWide
Автор

thank you for sharing your knowledge !

luisdavidherreragarcia
Автор

Thank you Thorben! Very well explained and pretty clear about each concept!

sunilcd
Автор

Your videos are good, this deserves more likes and views.

jilson
Автор

Thank you so much, this video helped a lot

tiituma
Автор

Very well explanation, could you please provide the link for Guide to JPQL Query?

surbhigangrade
Автор

The best videos about spring and jpa, really well organized and explained, pure gold thank you

ricardo.fontanelli
Автор

Great video.
May i know how to reference the fields declared indide the entity using SPeL.
It will be really helpful.

varunraj
Автор

when we bind parameters in case of my parameter is an object how can I bind one property of the object inside query. can I access it with dot notation

vtdx
Автор

While updating or altering the table with paramerter, spring jpa add extra quotes in query " ' " this single quote help

abhinavrayakwar
Автор

How do you use a list parameter with columns that you want to select? I tried something like "select ?3 from products where category = ?1 and status = ?2" . And ?3 is a List<String> with the columns that I want to select... but it does not work...

MsPaulisa
Автор

insert is possible here? I'm looking for insertion

NitrosS
Автор

can we do "select into" query in @Query ?

lokeshmurukesh
Автор

if you wanna insert use this:

@Modifying
@Query(value = "insert into author(first_name, last_name, version) values(?#{#author.firstName}, ?#{#author.lastName}, ?#{#author.version})", nativeQuery = true)

You have to use @Modifying
and maybe @Transactional. There is another method to insert and it's the EntityManager.

NitrosS
Автор

Could you please provide oracle r2dbc video series

maheshlokavarapu
Автор

hey, this is very good content, but the link provided for accessing the free java thoughts materials is not working, could I get those materials?
Thanks again!

ianwanjala
Автор

Hi Video is too good pls provide github link for source code

chetanbhandari
Автор

How to index pdf content by using spring-data?
We will really appreciate if some one can answer this question.

ursfren