Spring Data JPA: Query Projections

Поділитися
Вставка
  • Опубліковано 3 лис 2024

КОМЕНТАРІ • 19

  • @ronaldcastaneda2547
    @ronaldcastaneda2547 3 роки тому

    You are the best, thanks for the information.

  • @sergiowwwat
    @sergiowwwat 4 роки тому

    That was great! I didn't know that spring could fetch entity properties in a DTO projection based on parameter names on the constructor! I always coded the constructor expression in the query...

  • @andromadusnaruto1544
    @andromadusnaruto1544 4 роки тому

    Good day, @Thorben. I've been subscribed to your mailing list for a while and I've enjoyed your awesome content, especially with regards to Java Hibernate framework.
    My first time being on the channel. I wish you the best.
    I have committed to learning Spring framework + Hibernate framework by the end of this year or early next year. I have good practical knowledge of Java and
    OOP design principles.

  • @cinemaismywife
    @cinemaismywife 4 роки тому +1

    Great tutorial, Please tell me how to fetch child data by a certain field from parent using spring projections. Thanks. Subscribed!

  • @davidfelipegarciasegura8863
    @davidfelipegarciasegura8863 3 роки тому

    Great tutorial, thanks.

  • @ebichu8126
    @ebichu8126 4 роки тому

    Hey Thorben,
    Thanks for your great video.
    I see many people are using JDBC template for fetching DTO because it is highly customizable.
    But I think JDBC template is easily messed up, and error-prone, and it is not readable when the query takes dynamic WHERE conditions.
    Could you let us know there is any benefit to use JDBC template against Spring Projection when it comes to outbound DTO projection?
    Thanks!

  • @chiths
    @chiths 3 роки тому

    Good video .. can u please do a lesson based on using Criteria Builder with associations (joins)

  • @somias1575
    @somias1575 27 днів тому

    Performance wise which is better ? protection interface or DTO class ?

    • @Thorben-Janssen
      @Thorben-Janssen  11 днів тому

      It doesn't make a difference as long as your projection interface doesn't model any relationship and doesn't use Spring's expression language

  • @gurugovindgarg3771
    @gurugovindgarg3771 3 роки тому

    Great tutorial, How can we populate interface projection from Json file for testing

  • @anjanx44
    @anjanx44 Рік тому

    Great content, but how to use class dto for store procedure?

  • @mukhirais6557
    @mukhirais6557 2 роки тому

    How to pass associate object in constructor in JPQL query. Just u have shown only passing properties not obj.

  • @khairnarshekhar
    @khairnarshekhar 4 роки тому

    I'm using Interface projtion and one of the get method in interface of type OffsetDateaTime but it's giving error.. could you please shade some light on the issu

  • @cinemaismywife
    @cinemaismywife 4 роки тому

    Please tell me how to fetch child data by a certain field from parent using spring projections.

  • @kennyng9684
    @kennyng9684 4 роки тому

    Good day @Thorben, i have a use case which i'm trying to glue graphql with jpa. The problem is queries from graphql are dynamic. They are then converted to JPA CriteriaQuery to generate projections and predicates to construct SQL. I need to map my resultset back to the JPA entity. I have tried AliasToBeanResultTransformer to auto-map my projections. I'm using hibernate beneath it. Unfortunately, I realised JPA CriteriaQuery converted to HQL is not producing aliases in the projection although I have configured aliases. This result in AliasToBeanResultTransformer not able to map the resultset back to the entity attributes. Do you have any reccomendation?

    • @jayashreeerrabelli4258
      @jayashreeerrabelli4258 3 роки тому

      How did you resolve this ? It is expecting a constructor for every combination of attributes in select and groupby clauses, I have configured aliases too but nothing seems to work

    • @kennyng9684
      @kennyng9684 3 роки тому

      @@jayashreeerrabelli4258 yes, in the end, i did a walkaround and rewrite the jpql to create the alias myself

  • @Quester82
    @Quester82 2 роки тому

    When you need a class based DTO projection you can't use nested fields. There is no support for this out of the box.
    If you want to get unmanaged entity with nested fields like Collection you'll have to resort to using tools like Mapstruct.
    That was a real downside for me. Manageable but a downside non the less.

  • @vinaykaushikinvisble
    @vinaykaushikinvisble 4 роки тому

    Is projection can me mixed with specification?