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

Поделиться
HTML-код
  • Опубликовано: 26 янв 2025

Комментарии • 60

  • @kthun-v7c
    @kthun-v7c 6 месяцев назад +1

    0:00 Intro
    1:42 JPQL Queries
    4:18 Sorting
    5:52 Paginating Query Results
    6:49 SpEL Expressions for Entity Names & Advabced Like Expressions
    8:24 Native Queries
    9:53 Parameter Handling
    12:13 Modifying Queries
    13:00 Conclusion
    14:25 Thoughts on Java Library

  • @DreamingWithEyesWide
    @DreamingWithEyesWide Год назад +1

    Best videos about JPA- thanks for making them!!

  • @4jilson
    @4jilson 5 лет назад +6

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

  • @ricardo.fontanelli
    @ricardo.fontanelli 4 года назад +4

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

    • @manuelkyle6591
      @manuelkyle6591 3 года назад

      You prolly dont care but does anyone know of a method to get back into an Instagram account..?
      I was stupid lost the password. I would appreciate any assistance you can give me!

    • @jaggerowen4148
      @jaggerowen4148 3 года назад

      @Manuel Kyle instablaster :)

    • @manuelkyle6591
      @manuelkyle6591 3 года назад

      @Jagger Owen I really appreciate your reply. I found the site through google and I'm in the hacking process now.
      Takes a while so I will get back to you later with my results.

    • @manuelkyle6591
      @manuelkyle6591 3 года назад

      @Jagger Owen it did the trick and I actually got access to my account again. Im so happy!
      Thank you so much you saved my account!

    • @jaggerowen4148
      @jaggerowen4148 3 года назад

      @Manuel Kyle You are welcome :)

  • @MsPrettyg00d
    @MsPrettyg00d 4 года назад +1

    Your instructions are clear and short👍. Thank you!

  • @memillin
    @memillin Год назад

    12:06 It seems that named bind parameters are flipped.

  • @luisdavidherreragarcia281
    @luisdavidherreragarcia281 3 года назад

    thank you for sharing your knowledge !

  • @sunilcd2008
    @sunilcd2008 3 года назад

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

  • @gamatossian
    @gamatossian 4 года назад +1

    I think there's a small error there @ 12:00?
    @Param("lastName") String firstName, @Param("firstName") String lastName
    Assuming it should be:
    @Param("firstName") String firstName, @Param("lastName") String lastName

  • @surbhigangrade9251
    @surbhigangrade9251 6 месяцев назад

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

  • @isurangaediriweera7073
    @isurangaediriweera7073 5 лет назад

    Your videos are really helpful. Thank you very much.

  • @varunraj1862
    @varunraj1862 Год назад

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

  • @nishantbahri
    @nishantbahri 4 года назад

    That was precise.

  • @sonofgod00
    @sonofgod00 2 года назад

    Thanks

  • @ianwanjala8621
    @ianwanjala8621 Год назад

    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!

  • @NitrosS
    @NitrosS 4 года назад

    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)
    void insert(@Param("author") Author author); //SpEL Expressions
    You have to use @Modifying
    and maybe @Transactional. There is another method to insert and it's the EntityManager.

  • @Francis_dev
    @Francis_dev 4 года назад

    thank you, grettings from chile

  • @tiituma
    @tiituma 4 года назад

    Thank you so much, this video helped a lot

  • @paolofrancescosciammarella1420
    @paolofrancescosciammarella1420 2 года назад

    thank u so much!

  • @NitrosS
    @NitrosS 4 года назад

    insert is possible here? I'm looking for insertion

  • @maheshlokavarapu9696
    @maheshlokavarapu9696 3 года назад

    Could you please provide oracle r2dbc video series

  • @vtdx4
    @vtdx4 4 года назад

    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

  • @abhinavrayakwar6676
    @abhinavrayakwar6676 4 года назад

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

  • @MsPaulisa
    @MsPaulisa 4 года назад

    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 with the columns that I want to select... but it does not work...

  • @amitdhakal1974
    @amitdhakal1974 3 года назад

    But no customized delete option in the query

  • @esperanzacutillasrastoll6722
    @esperanzacutillasrastoll6722 4 года назад

    how do you do a left join with that? Thank you. With to related entities with a one to one relationship

    • @Thorben-Janssen
      @Thorben-Janssen  4 года назад +1

      You can use all features of JPQL in your custom query. LEFT JOIN is one of them. Find out more here: thorben-janssen.com/jpql/

  • @UTUBDZ
    @UTUBDZ 4 года назад

    Guten Tag Janssen ! Can you give a hint on how to write a JPQL queries when the WHERE close contains objects (Ex: SELECT * FROM USERS WHERE userBooks.count(*) > 10)

    • @Thorben-Janssen
      @Thorben-Janssen  4 года назад

      Is userBooks a managed association?
      If it is, you could use the size function to count the elements in it, e.g.: SELECT u FROM Users WHERE SIZE(u.userBooks) > 10

    • @UTUBDZ
      @UTUBDZ 4 года назад

      ​@@Thorben-Janssen Thank you very much for your reply.

  • @MrProton2
    @MrProton2 4 года назад

    How Spring Data JPA Native Querry worked with SELECT FOR UPDATE SKIP LOCKED ?

  • @lokeshmurukesh3386
    @lokeshmurukesh3386 4 года назад

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

  • @rajuTravelMemories
    @rajuTravelMemories Год назад

    Could u please help me on thi
    Caused by: java.lang.IllegalArgumentException: Can't compare test expression of type [CommodityEntity] with element of type [BasicSqmPathSource(materialId : Long)]

  • @senthilmurugangsm
    @senthilmurugangsm 4 года назад

    How can we select few columns in @Query annotations and return the list of entities with only those specific columns as JSON. (Not all values of entity)

    • @Thorben-Janssen
      @Thorben-Janssen  4 года назад +1

      Hi Senthil,
      you can only select an entity with all its attributes. If you want to select a subset, you need to use a DTO projection.
      I explain that in this video: ruclips.net/video/IPRfz97-NqA/видео.html
      In the video, I only use Hibernate without Spring Data JPA. But you can apply the same approach using Spring.
      Regards,
      Thorben

    • @senthilmurugangsm
      @senthilmurugangsm 4 года назад

      @@Thorben-Janssen thanks for the response. Is any other way available by without creating another pojo class ?

  • @ursfren
    @ursfren 4 года назад

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

  • @chetanbhandari3033
    @chetanbhandari3033 4 года назад

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

  • @TylerBrewster-o5w
    @TylerBrewster-o5w 3 месяца назад

    559 Meta Circle

  • @davincibaker
    @davincibaker 7 месяцев назад

    WHAT ABOUT INSERTS ?

  • @AllisonDominguez-t9o
    @AllisonDominguez-t9o 4 месяца назад

    Cedrick Island

  • @HearstAnastasia-j6w
    @HearstAnastasia-j6w 3 месяца назад

    Frederique Walk

  • @HuxleyQuinn-t6o
    @HuxleyQuinn-t6o 4 месяца назад

    Mathew Dam

  • @GregoryWright-r9n
    @GregoryWright-r9n 4 месяца назад

    Brock Fields

  • @WalkerOConnor
    @WalkerOConnor 4 месяца назад

    20885 Audra Station

  • @yadigarcaliskan6453
    @yadigarcaliskan6453 Год назад

    Why does spring try to overtake the industry? I don’t like

  • @ThodoreWilbur
    @ThodoreWilbur 3 месяца назад

    0435 Lea Glen

  • @treeteqs
    @treeteqs 4 года назад

    what about @restresource

  • @sidof8065
    @sidof8065 8 месяцев назад

    Thanks for the content ! how write jUnit test of class with enum properties. Like
    public interface HouseRepository extends PagingAndSortingRepository {
    Page findByHouseTypeContaining(HouseType houseType, Pageable pageable);
    }
    @Entity(name = "house")
    public class House {
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "house_sequence")
    @SequenceGenerator(name = "house_sequence",sequenceName = "house_sequence",allocationSize = 1)
    private Long id;
    @Enumerated(STRING)
    private HouseType houseType;

  • @NicholasBarry-u7g
    @NicholasBarry-u7g 3 месяца назад

    16020 Hudson Bridge

  • @LouiseDonald-rw9ox
    @LouiseDonald-rw9ox 4 месяца назад

    40296 Moen Turnpike

  • @JenellePregeant
    @JenellePregeant 4 месяца назад

    7888 Alysa Mountain

  • @BeminHania
    @BeminHania 3 месяца назад

    32429 Dietrich Trafficway