Type: New Feature
Currently Indices are only provided via @UniqueConstraint. The main downside of this annotation is that you need to specify the database column names. This is often broken and not easy to maintain.
Another problem: there is atm no way to explicitly define a name for an Index. Which means the database will generate one and you have no way to properly change it later. There is also no easy way to detect any unused Indices.
Here are a few requirements I would have for such a system:
- typesafety - using column names or field names is not really refactoring friendly
- allow naming an Index
- index sorting. CostBased optimizers are nowadays pretty good already, but there is still some need for explicitly defining the order of the columns in an index. wdyt?
- allow multiple indices on an entity.
- support unique/sorting type indices
- if it fits we could also think about logical-key support