-3

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

1 Answers1

1

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.

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348