Part 2 - Infinite RecursionStackOverflow Problem Solved in JPA

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • Infinite RecursionStackOverflow Problem Solved in JPA using
    JsonManagedReference,
    JsonBackReference,
    JsonIdentityInfo
    Subscribe Kindson The Tech Pro RUclips: bit.ly/2PpJd8Q
    Join my group ICS on Facebook: bit.ly/2UULiQj
    Follow me on Instagram - / kindsonm
    Connect with me on LinkedIn: / kindson
    Follow me on Twitter: / kindsonm
    Learn about me: www.kindsontheg...

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

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

    As a jr. dev making his first own application from scratch for work: THANK YOU! I simply didnt know about the annotation! Big help!

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

    Wow bro lovely, I was running over the internet all over but did not find the solution.... Amazing bro, thankk you so much

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

    I'm Brazilian, you helped me a lot, thank you

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

    Thank you so much . I just have a question. Can it work for more than one relationship, that is, if this same departments table were related to the Professors table, can you use the @JsonBackReference and @JsonManagedReferences annotations for these tables?

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

    You're the best, thanks so much! Subscribed!

  • @mohamedifthikharmohamednas4109
    @mohamedifthikharmohamednas4109 2 года назад +1

    Information is apt for this topic!!

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

    I'm using jsonidentify but i still got problem with many to one relation, when i show json data from the child, the parent data still repeat it's child list , i want to remove it, please help me

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

    Thanks my bro... You have earned the sky

  • @emman2life
    @emman2life 4 года назад +2

    Hi, thanks for this tutorial. please which database are you using? please can you make a video on how u link it on spring?

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

      Emmanuel Imhontu , see here ruclips.net/video/lJQoLIK8LQQ/видео.html

  • @MsProtestante
    @MsProtestante 6 месяцев назад +1

    Very good stuff! Congrats!

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

    This video helped me a lot Thanks really perfect

  • @NTICTECH
    @NTICTECH 3 года назад +1

    Thanks so much! great video

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

    Hello in case of microservices we have to put annotation on DTOS or Entity?

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

    Спасибо

  • @MrFahimansari
    @MrFahimansari 2 года назад +1

    Thanks so much. The video is really informational. I have a doubt, will this apply for one to one bidirectional relationships also

    • @KindsonTheTechPro
      @KindsonTheTechPro  2 года назад +1

      It works for bi-relationships as well

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

      @@KindsonTheTechPro hey I wanted to know if it works for one to one mapping also?

  • @wilsonho4577
    @wilsonho4577 5 лет назад +1

    does it work on files that have multiple one to many and many to one relationship?

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

    i am getting only id values instead of complete object please help me..

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

      Check your getters and setters. Also check you have two constructors. Let me know the outcome

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

    Thanks so much! great video but how could you solve this problem with many to many relation? I'd appreciate very much your answer :)

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

      the solution above stops the recursive loop error.... but with many-to-many, it gives a nested feedback ... which DOSE solve the problem but provides another :)

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

    Amazing job!!!

  • @Aakashkumar-pc3xs
    @Aakashkumar-pc3xs Год назад

    Hey is there any way to do this without any extra annotation, because in my previous company my manager use to do bi-directional mapping with any extra annotation, and all data was coming perfectly.

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

      write your custom methods for saving

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

    Thanks for the solution.

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

    Thank you very much, I'm Brazuca and you helped me a lot

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

    You just saved me!

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

    Hello sir, I am getting same issue with many-to-many relationship with composite primary key in jpa using third table
    Can you please suggest how to resolve this issue

  • @nguyenphuongduycthuchanhfp1569
    @nguyenphuongduycthuchanhfp1569 3 года назад +1

    Thanks so much :))

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

    it was very useful..Thank a lot !!!..

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

    thanks!

  • @RamKumar-rg3gr
    @RamKumar-rg3gr 4 года назад

    sir please make font large so mobile user can see easily

  • @Sensei_coding
    @Sensei_coding 4 месяца назад +1

    @JsonIgnore

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

    LOMBOK USERS: If you're scratching your head because none of this works, it's because of Lombok! It's generating .toString, .equals, and .hashCode methods in the Student class that calls these same methods in the Department class, which in turn calls the Student methods and on and on!
    The solution is to put the following annotations above the department property in Student class:
    @ToString.Exclude
    @EqualsAndHashCode.Exclude
    That will omit the company property from these methods, breaking the recursion loop. Hope this helps!

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

    Hi Kindson,
    can you please help me solve this because it is not working for me, if there is any setting required please let me know. thanks in advance.
    @Data
    @Entity
    @Table(name = "address")
    public class Address {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;

    @Column(name ="address")
    private String address;

    @ManyToOne
    @JoinColumn(name = "user_id")
    @JsonBackReference
    private User user;
    }
    @Data
    @Entity
    @Table(name = "user")
    public class User {

    @Id
    @Column
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;

    @Column(name ="username")
    private String name;

    @OneToMany( mappedBy = "user", cascade = CascadeType.ALL, targetEntity = Address.class)
    // @JoinColumn(name = "user_id", referencedColumnName = "id")
    @JsonManagedReference
    private Set addresses = new HashSet();
    }