jakartaee / persistence

https://jakartaee.github.io/persistence/
Other
208 stars 59 forks source link

@MapKey(name=...) inconsistent with @OrderBy(....) #684

Open gavinking opened 4 days ago

gavinking commented 4 days ago

@MapKey and @OrderBy are extremely conceptually-similar in that they each reference a field of the associated entity. They are both different to @OrderColumn and @MapKeyColumn in that these latter annotations provide column names.

But @MapKey has a name member like @XxxColumn annotations instead of a value member like @OrderBy.

This is inconsistent and unnecessarily verbose.

I think we should add value and deprecate name.

gavinking commented 4 days ago

In a way it should really be @MapKey(mappedBy= .... ). That would make the true semantics much clearer.