Spring Boot Restful + PostgreSQL + JPA Hibernate Stored Procedure Functions @Procedure - Part 9

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ต.ค. 2024
  • In this video I have explained how to call Stored Procedure / DB Functions and what are the ways to handle the results.
    Repository Link:
    gitlab.com/lsi...
    Topics covered in this video:
    1. Entity Manager
    2. @Procedure
    3. @NamedStoredProcedureQuery
    4. @SqlResultSetMapping
    Runtime Exceptions covered in this video:
    1. org.hibernate.MappingException: No Dialect mapping for JDBC type: 1111
    2. org.hibernate.MappingException: Cannot mix named parameters and REF_CURSOR parameter on PostgreSQL
    3. org.postgresql.util.PSQLException: cursor unnamed portal 1 does not exists

ความคิดเห็น • 28

  • @semugutkha1258
    @semugutkha1258 3 ปีที่แล้ว +2

    Thank you man, this is exactly what I needed. I will try this out and get back to this video.

  • @TheLoveking1982
    @TheLoveking1982 ปีที่แล้ว +1

    Hi Bro,This is realy useful for me and thanks for sharing this vedio. but ur voice is very lower to hear u

  • @sagarsomwanshi4533
    @sagarsomwanshi4533 2 ปีที่แล้ว +5

    Thanks for giving a Nice Explanation for JPA with the procedure ..But the whole video is for the calling function not the Store procedure in PostgreSQL ..Could you please give that example?

    • @ElAdamska
      @ElAdamska 9 หลายเดือนก่อน

      Hi! In PostgreSQL we call functions not stored procedures

  • @pulkitkaushik4539
    @pulkitkaushik4539 3 ปีที่แล้ว +1

    Great stuff man.. i will definitely try it and get back if i face anything

  • @MessierNoventayNueve
    @MessierNoventayNueve ปีที่แล้ว

    Thanks. lot of thanks, was an great helpfull video.

  • @HariKrishna-ir2mx
    @HariKrishna-ir2mx 3 ปีที่แล้ว +1

    Thanks for sharing this bro

  • @AhmadHamid
    @AhmadHamid ปีที่แล้ว

    @Procedure didn't work if the function is not defined in the public schema on postgresql

  • @HariKrishna-ir2mx
    @HariKrishna-ir2mx 3 ปีที่แล้ว +1

    According to you, which one is better to call DB object in Spring boot.. please reply

    • @LetsSortItOut
      @LetsSortItOut  3 ปีที่แล้ว +1

      If you are familiar with SQL, then Native query seems the easiest way to do this. But remember we use ORM for some really good reasons. For example: 1. it is database independent. 2. Every time you perform database operations through your JPA implementation it will also take care of the validation part before submitting it to the database (If you defined the validation), so you can limit the unnecessary traffic to your database server. 3. It encapsulates the actual database definition. 4. If you are working in a team it also removes that personal touch of the developer and the code looks more universal and easy to understand. So I recommend to use JPA whenever possible. By saying this I am not undermining the importance of Native queries, because there are some instances during development where you really need to use Native Queries as well.

  • @rajchavan860
    @rajchavan860 8 หลายเดือนก่อน

    I am getting an exception that says.
    java.lang.NullPointerException: Cannot invoke "java.util.iterator" because "this.parameters" is null.

  • @thiru53
    @thiru53 2 ปีที่แล้ว

    Hi, i am getting following error in oracle DB with same
    ORA-06553: PLS-306: wrong number or types of arguments in call to 'procedure'

  • @nilolima5401
    @nilolima5401 ปีที่แล้ว

    How i can create Stored Functions in Spring Boot????

  • @karthickselvam3938
    @karthickselvam3938 3 ปีที่แล้ว

    Hi Man,
    Please help...How to map multiple result set from one single SP.

  • @minmai1357
    @minmai1357 2 ปีที่แล้ว

    How about procedure using multiple tables ? Please help me

  • @ThabiraGamingShorts
    @ThabiraGamingShorts 3 ปีที่แล้ว +1

    Hi Sir,
    I am getting "No Dialect mapping for JDBC type: 1111" this error for void method
    is there any fix for this

    • @LetsSortItOut
      @LetsSortItOut  3 ปีที่แล้ว +1

      The same error is handled in this video, watch from 10:51onwards. If you are still getting error, then I need more details. Possibly the stack trace of the error. Have you tried the source code that I uploaded on Gitlab? This error generally occurs when Hibernate is unable to map the return type. So basically first you need to check the procedure/function and write it according to this tutorial. Second, return type of the caller function in Repository. The return type of the DB function should be record if you are using PostgreSQL.

  • @EjazAhmad-xs6cc
    @EjazAhmad-xs6cc 3 ปีที่แล้ว

    Hello sir,
    I am trying with these code but with SQL Oracle developer,I am not getting,can you help me

  • @venkatesh4v
    @venkatesh4v 3 ปีที่แล้ว +1

    Hello Mate, The video is very good and your explanation too. But in the real world project we get the result set from procedure from different tables.
    Ex: select A.a,B.b,C.c
    from table A, table B,table C
    where A.id=B.id and B.id=C.id
    column a from table A, column B from table B etc...how to handle this scenario or map in @Entity.

    • @LetsSortItOut
      @LetsSortItOut  3 ปีที่แล้ว +1

      OK I will come up with a separate video on this.

  • @yaswanthsatyavarapu3800
    @yaswanthsatyavarapu3800 3 ปีที่แล้ว

    Nice video,
    If there are placeholders in sql stored procedures, then how to handle it in spring boot.
    Please explain this

  • @juerguenherrera5927
    @juerguenherrera5927 2 ปีที่แล้ว

    Thank You

  • @vageeshanvageesh5583
    @vageeshanvageesh5583 2 ปีที่แล้ว

    Great 😊

  • @ciliyaciliya2294
    @ciliyaciliya2294 2 ปีที่แล้ว

    Is it possible to pass entire insert query to a function or procudre via spring jpa?

    • @ElAdamska
      @ElAdamska 9 หลายเดือนก่อน

      When using PostgreSQL functions, you can either pass arrays, parameters or even custom Postgresql types as input elements.

  • @tanvia29
    @tanvia29 2 ปีที่แล้ว

    What are the benefits of using @Procedure over @Query?

    • @ElAdamska
      @ElAdamska 9 หลายเดือนก่อน

      More than benefits I saw limitations when using @Procedure

  • @EjazAhmad-xs6cc
    @EjazAhmad-xs6cc 3 ปีที่แล้ว

    How can I contact you