spring-data-relational icon indicating copy to clipboard operation
spring-data-relational copied to clipboard

Migrate AggregateReference to the relational package

Open mipo256 opened this issue 4 months ago • 4 comments

The AggregateReference is now a part of JDBC module solely, which is a bit strange from my perspective, since the AggregateReference makes sense it R2DBC module as well when moduling the relationships.

Maybe we want to migrate it to the relational module?

mipo256 avatar Aug 17 '25 06:08 mipo256

The problem become even more obvious, when dealing with #2113. When dealing with composite foreign keys via AggregateReference, it turned out that we need to, among other things, make the MappingRelationalConverter aware of the existence of an AggregateReference, which seems reasonable, but the MappingRelationalConverter is located in relational module, whereas AggregateReference is located under jdbc module

mipo256 avatar Aug 17 '25 16:08 mipo256

I agree that it would be nice to move AggregateReference into relational. But in order to not confuse people more than necessary, we should properly support it in R2DBC.

For #2113 it would be sufficient to just fix it in the JdbcMappingRelationalConverter.

schauder avatar Aug 18 '25 07:08 schauder

And we should do it in a backward compatible way. I.e. create a new AggregateReference, let the old one extend the new one and deprecate it.

schauder avatar Aug 18 '25 07:08 schauder

That makes sense, @schauder, thank you.

I'll focus now on #2113, since this bug seems to be more important. I think we will be able to get by the AggregateRefernce limitation. Once I'll complete the #2113, I'll get back here and extend this PR to account for the problems you've pointed out.

mipo256 avatar Aug 18 '25 07:08 mipo256