Equivalent of hibernate @Index?
hibernate, java
Solution
As specified by the answer here the index annotation in `javax.persistence.Index` can only be used as part of another annotation.
@Table(name = "myTable", indexes = { @Index("name")})
@Entity
class MyEntity {
@Index(name = "name")
private String name;
@Index(name = "age")
private int age;
}
Problem
The hibernate annotation `@Index` is deprecated, but I can't find docs or any hints how to exchange it. ``` @Entity class MyEntity { @Index(name = "name") //org.hibernate.annotations.Index private String name; @Index(name = "age") private int age; } ``` Result: `@deprecated Using {@link javax.persistence.Index} instead.` But if I change the import: `Annotation disallowed for this location`. So: how does the above entity have to look like when using non-deprecated index?