Can I know how to do association(One to Many) in Spring data JDBC with R2DBC(Mysql).Please provide small code example or git link if possible.
For Example, I have one employee table and address table is child of employee. One employee can have multiple addresses. If I want to retrieve employee, I want address as well to corresponding employee as JSON. Note: Software stack is Spring Functional Reactive, R2DBC with Mysql
Spring Data R2DBC currently does not support aggregates. This means every entity gets mapped to just one table and can't have object references to other entities.
Therefore the correct way to model your example is to have no object reference between Empolyee
and Address
but have an employeeId
in the Address
and use that to select the desired addresses.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.