'How to map data with one-to-many relationship in spring JDBC?
I would like to ask for suggestions from all of you guys, which is the best choice to fetch data with ONE TO MANY relationship using Spring JDBC? I decide to use Spring JDBC because I have a complex query.
Ex: I have two tables which are student and subject. A student can study many subjects. So, I will join these tables using one-to-many relationships.
- Join level DB: I can join on the level database but I need to map on level by code using loop then add subjects as a list of student objects.
- Call separate query, One for student and using student_id to find in subjects table
what do you think, please give me the advice? Thank you!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
