Check the attached example project. Run DemoApplicationTests to see the problem. I noticed this on Spring Data JDBC 3.2.5. Also applies to 3.3.0. 3.1.12 works as expected. It seems to me that the id of the root table is erroneously used for fetching the set. This is highly dangerous as wrong data is returned and if the returned aggregate is saved back to the database then the wrong set data is persisted.
Check the attached example project. Run DemoApplicationTests to see the problem. I noticed this on Spring Data JDBC 3.2.5. Also applies to 3.3.0. 3.1.12 works as expected. It seems to me that the id of the root table is erroneously used for fetching the set. This is highly dangerous as wrong data is returned and if the returned aggregate is saved back to the database then the wrong set data is persisted.
bug.zip