spring-projects / spring-data-relational

Spring Data Relational. Home of Spring Data JDBC and Spring Data R2DBC.
https://spring.io/projects/spring-data-jdbc
Apache License 2.0
771 stars 346 forks source link

Support List without @MappedCollection(keyColumn=) [DATAJDBC-630] #848

Open spring-projects-issues opened 4 years ago

spring-projects-issues commented 4 years ago

Veli-Pekka Muli opened DATAJDBC-630 and commented

Currently the only way to have collections that don't have an order column in the database is to make the collection a Set. This is limiting as Set does not allow duplicate elements and Spring Data JDBC shouldn't force the type of the collections that the entities can have like this. If I want to sort the collection in my code then it might be confusing for the reader because I was forced to use Set which usually isn't ordered. @MappedCollection should be optional for Lists


No further details from DATAJDBC-630

spring-projects-issues commented 4 years ago

Jens Schauder commented

I agree in principle, but it shouldn't be represented by a List but a separate datatype. Hibernate calls it a Bag

spring-projects-issues commented 4 years ago

Veli-Pekka Muli commented

Doesn't Hibernate Bag map to List? Having some non-standard data type would add Spring Data JDBC as a dependency of my entities

spring-projects-issues commented 4 years ago

Jens Schauder commented

Very good point

spring-projects-issues commented 3 years ago

Jens Schauder commented

After some internal discussion we decided that Collection would be a good way to mark a collection has not specifying an order but potentially having multiple identical entries