Oddly, this information was very difficult for me to find. I've been stuck trying to figure out how to configure the relationships between entities until I found this video. It was clear, concise, and best of all, my code is now working. Much appreciated Kris!
Very helpful! I was playing with JPA and kept having the infinite recursion problem with my many-to-many relations and hadn't even though the REST controllers. I watched this and fixed my backend. Great job!
Fantastic tutorial. I was has the recursion issue and this fixed it right up! Very good tutorial with brilliant explanations. Thank you! You should do a Udemy course in Spring
I did everything the same but i still take an error about recursion :( I used List rather than using Set and my problem is solved. Thank you by the way. I was looking a tutorial like this. I spent all of my day on internet to learn how to create a relationship between my tables.
Currently I’m having an issue mapping columns from two different entities to the database I created in MySql. The annotations are correct and all the dependencies are allocated to the pom.xml file. There is a connection with the workbench client and the server is running. However, there are still red lights under on the columns annotations names I’ve selected. I try selecting each column a placing them into the single data source but it is not working ?
Hi Kris, your video was super helpful to fix my relationship mapping in the backend, but now I need to implement it in Angular . Would please make a video on how to implement that in Angular ?
Why not divide packages with controllers, services, repositories and models? And why use Autowired annotation instead of the better constructor injection solution?
if it was a movie it can get a oscar nomination ❤️. Thank you for making us understand relationships easy. Could you please give us sample how we structure rest controller calls prod projects. Thank you
Very good explatation. But I give some issue. When I use everywhere Set bettwen relationship I've got recursion problem. Replacing Set into List in Student class fix problem but I don' t konw why. Some advice ? Thanks to all.
@@elkamillo123 Hey, I know this is a late response, but I have spend hours researching this and I think I have the reason. Apparently it is not good practice to use Lists, as they don't perform well and they could lead to other issues. The reason we are all having this problem is due to lombok. If you remove the @data annotation, and create getters and setters , I believe you can then use the @JSONIgnore annotation, which will then allow you to stop using lists! Hope this helps!
@Kris Foster I have a question about the ManyToMany. If i want to add the Subject in the Student Set. How would it be? because i get an Exception when i try to save the student with the added subject.
I exactly faced the recursion issue, so your video helped a lot to understand root cause. In case if we want to retrieve Student with subjects as well then how can we do that ?
You can just do a select statement on the subject tables. Select * subject FROM Table_Name where student-id = 1 This is just an example so I did not use the correct names. I was to lazy to check.
Awesome tutorial! Now I just need to figure out how to delete students, teachers, and subjects. I get a 500 error when I try due to violating foreign key constraints.
I really don't understand why there's so little about managing relationships when creating rest api. It's bonkers to me. What good is post and user to me, when I can't even display posts of user
Thank you so much for the tutorial! I was days trying to set up the relationship between my two entities, but I wasn't doing it right, so it wasn't working
The moral of the story is , in short need to create a customer with all dependent objects and data should get stored in the respective tables and when that customer is deleted then all the data related to that customer in the respective table should also get deleted , Thanks
The thing is what if you wanna see the subjects of one student? You would need to use the design pattern DTO (Data transfer object) right? Thats what I would do since @JsonIgnore is kind of forcing me to do so, what other solution do you recommend? Nice tutorial =)
Why did you start from many to many relations ? It's hard for beginners to understand. Start from one to one, one to many, many to one, many to many. In this order.
Great video, I just wish you would have had an example of @Getmapping which would have returned results for a one to many with the the query: SELECT a.name "Teacher", b.name "Subjects" FROM TEACHER AS a JOIN SUBJECT AS b ON a.id=b.TEACHER_ID And/Or a @Getmapping for the results from the many to many relationship with a filter such as: SELECT a.name "Subject", c.name "Student" FROM SUBJECT AS a JOIN STUDENT_ENROLLED AS b ON a.ID=b.SUBJECT_ID JOIN STUDENT AS c ON c.ID=b.STUDENT_ID where a.name='Science'
Oddly, this information was very difficult for me to find. I've been stuck trying to figure out how to configure the relationships between entities until I found this video. It was clear, concise, and best of all, my code is now working. Much appreciated Kris!
Detailed, clear and concise tutorial, hard to find such straightforward learning.
Very helpful! I was playing with JPA and kept having the infinite recursion problem with my many-to-many relations and hadn't even though the REST controllers. I watched this and fixed my backend. Great job!
That's great, nice name, Kris!
Fantastic tutorial. I was has the recursion issue and this fixed it right up! Very good tutorial with brilliant explanations. Thank you! You should do a Udemy course in Spring
The fisrt best tutorial i have come across . It's hitting the nail on the head at the right time for me. Thannks so much teacher.
this is the best video explaining jpa relationships!!! Thank you soo much for sharing your knowledge :)
Thank you for the kind feedback and glad you enjoyed!
I think this is the most useful resource on spring relationships
Great tutorial - short, concise, clear and with practical examples.
Another great spring boot video Kris.
@Ryan Hill thanks for the feedback & glad you enjoyed!
Great tutorial. To the point and clearly explained. Thanks!
Gracias por impartir todos tus conocimientos, al fin entendí cómo hacer relaciones con JPA.
thank you so much sir this saved my life am stuck in my project for like 3 days in the many to many and u just saved me thank you dear sir
I'm sharing this tutorial with all my colleagues. Amazing!
From Egypt : You are my hero with good explanation❤♥♥♥♥
I WANNA THANK YOU A MILLION TIMES FOR THIS VIDEO. VERY VERY VERY HELPFUL !!!!!
very clear and going to point easly than others
I recomend any one how wants to learn ERD in a smiple way
from that toturial
Thank you, I needed to refeersh a bith JPA relationships and this video is very well done.
I did everything the same but i still take an error about recursion :( I used List rather than using Set and my problem is solved. Thank you by the way. I was looking a tutorial like this. I spent all of my day on internet to learn how to create a relationship between my tables.
Thank you so much 💖
Probably you had repeated data in set. Set don't accept repeated data, but, list accept it.
This helped me but I think I need a REST example but this sure helped so appreciated!
I got my 100% of doubts cleared by this vedio. Its just crystal clear ❤️
very useful video and well explained, thanks a lot Kris
Glad you enjoyed, thank you
Awesome video Kris ! It was so useful to me ! Thanks a lot !
Glad you enjoyed @Diego Ruiz, thank you for the feedback!
Very decent explantion Kris....Thanks for that😊
Thank you for the feedback @Lakshmi Narayana
Kris Foster is my new Hero!
Nice ,really nice...you just got a new subscriber:)
Thanks a lot for this video, I enjoyed it and learned a lot from it
Currently I’m having an issue mapping columns from two different entities to the database I created in MySql. The annotations are correct and all the dependencies are allocated to the pom.xml file. There is a connection with the workbench client and the server is running. However, there are still red lights under on the columns annotations names I’ve selected.
I try selecting each column a placing them into the single data source but it is not working ?
Great video! It really helped me to create the relationships on my database. Thanks a lot!
Good Explanation. Keep going mate!
Thank you for the kind feedback @Raja Mani!
That was nicely explained tutorial. Thanks. Create more of this kind.
Me salvaste, que gran aporte, saludos
How does it know the column where it has to put the user id. Does it deduce it from the string?
Thanks so much. This was really great to understand the relationships
Good Material for JPA . Good job 👌
Glad you enjoyed!
Thank you, well done it was a great explanation.
Thank you, glad you enjoyed!
Came here by coincidence. Now I'm permanently here
Hi Kris, your video was super helpful to fix my relationship mapping in the backend, but now I need to implement it in Angular . Would please make a video on how to implement that in Angular ?
Thanks, Dude! Your tutorial helped me completed my task ))
well explained kris and nice tutorial
Thank you for the feedback, glad you enjoyed!
It’s very helpful 🎉. Thanks
Is there a way to have a teacher assigned to the subject from inception?
how to create subjects with a default teacher on post itself? Isn't it possible?
Thanks kris!! Really Helpful!!
I'm glad it helped, thank you for watching!
Why not divide packages with controllers, services, repositories and models? And why use Autowired annotation instead of the better constructor injection solution?
You really help me thank you ❤️
thank you so so so so so much for this video, it helped me a lot.
Muchas gracias me sirvio mucho tu tutorial
Bravo teacher, just i would have a link fo r the serie of this course please
But how do you retrieve a one to many relationship.In this case teacher and subjects
if it was a movie it can get a oscar nomination ❤️. Thank you for making us understand relationships easy. Could you please give us sample how we structure rest controller calls prod projects. Thank you
Very good explatation. But I give some issue. When I use everywhere Set bettwen relationship I've got recursion problem. Replacing Set into List in Student class fix problem but I don' t konw why. Some advice ? Thanks to all.
Had the same issue, replacing one Set by a List worked for me too. Can't explain why either... but thanks for the hint! :)
@@elkamillo123 Hey, I know this is a late response, but I have spend hours researching this and I think I have the reason. Apparently it is not good practice to use Lists, as they don't perform well and they could lead to other issues. The reason we are all having this problem is due to lombok. If you remove the @data annotation, and create getters and setters , I believe you can then use the @JSONIgnore annotation, which will then allow you to stop using lists! Hope this helps!
I want to know how can we send the list of subjects in a single request using request body and how we'll assign it to student
Hi Mate, can you demo a many to many relationship where a student is drops a subject
thank you man , it's realy helpfull
@Kris Foster I have a question about the ManyToMany. If i want to add the Subject in the Student Set. How would it be? because i get an Exception when i try to save the student with the added subject.
need to do it the other way around
I exactly faced the recursion issue, so your video helped a lot to understand root cause.
In case if we want to retrieve Student with subjects as well then how can we do that ?
You can just do a select statement on the subject tables.
Select * subject FROM Table_Name where student-id = 1
This is just an example so I did not use the correct names. I was to lazy to check.
Awesome tutorial! Now I just need to figure out how to delete students, teachers, and subjects. I get a 500 error when I try due to violating foreign key constraints.
Thanks Bro! It's movie really good!!!
subbed and looking forward to more
I really don't understand why there's so little about managing relationships when creating rest api. It's bonkers to me. What good is post and user to me, when I can't even display posts of user
Thank you so much for the tutorial! I was days trying to set up the relationship between my two entities, but I wasn't doing it right, so it wasn't working
Very helpful tutorial
short and clear, thanks
Anyone know how can I getAll subjects for 1 teacher not all subjects?
The moral of the story is , in short need to create a customer with all dependent objects and data should get stored in the respective tables and when that customer is deleted then all the data related to that customer in the respective table should also get deleted , Thanks
Hello, great video! I am curious about what happens if I do not initialize Set and leave like this 'Set students;' Can you explain me please?
Hello i understand all examples how be @OneToOne?? one object type in each Class??. Saludos desde Lima - Perú!!
Clear and concise.
Great explanation
Does this include entity graphs? Please answer, I don't want to waste my time.
Great tutorial, thanks!!
Another way to solve the recursive problem is to use DTO pattern to present the retrieved data from database instead using JSON ignore!
The thing is what if you wanna see the subjects of one student? You would need to use the design pattern DTO (Data transfer object) right? Thats what I would do since @JsonIgnore is kind of forcing me to do so, what other solution do you recommend? Nice tutorial =)
write a select statement to retrieve the data from the join table
Thanks a lot sir
Gold, very clear.
thanks bro, i was have, this recursive error for 3 days, you save me. sorry for the english kkk
Thank you a lot!!!
great video mate
Great video 🔥
17:45
Thank you!
Note for myself
19:20
Why did you start from many to many relations ? It's hard for beginners to understand. Start from one to one, one to many, many to one, many to many. In this order.
Well done brother
thank you!
영상 잘 봤습니다 :)
Thanks!
you are the best !!!
Thank youuuuu!!
Nice accent, nice tutorial
Nice One
thanx man
Super
awesome
My name is simon :) i like
why are you not Indian????
Lindo
finally not indian!!!!!
Bad
Great video, I just wish you would have had an example of @Getmapping which would have returned results for a one to many with the the query:
SELECT a.name "Teacher", b.name "Subjects"
FROM TEACHER AS a
JOIN SUBJECT AS b
ON a.id=b.TEACHER_ID
And/Or a @Getmapping for the results from the many to many relationship with a filter such as:
SELECT a.name "Subject", c.name "Student"
FROM SUBJECT AS a
JOIN STUDENT_ENROLLED AS b
ON a.ID=b.SUBJECT_ID
JOIN STUDENT AS c
ON c.ID=b.STUDENT_ID
where a.name='Science'