如何在Hibernate中指定多列索引中的列顺序?

我正在创建一个多列索引,如下所示:
@Entity
public class Ranking extends Model {
    @ManyToOne
    @Index(name = "ranking_ix")
    public Rankable rankable;

    @ManyToOne
    @Index(name = "ranking_ix")
    public Criteria criteria;

    @Index(name = "ranking_ix")
    public double rank;
}
但是,我无法看到如何控制三列在复合索引中出现的顺序(这可能是确保最佳查询性能所必需的)。怎么能实现这一目标?     
已邀请:
尝试使用符号
@Entity
@Table(
    name="Ranking",
    indexes = { @Index(name="ranking_ix", columnNames = { "Rankable", "Criteria" } ) }
    )
public class Ranking extends Model {
    @ManyToOne
    public Rankable rankable;

    @ManyToOne
    public Criteria criteria;

    @Index(name = "ranking_ix")
    public double rank;
}
    
这可以使用org.hibernate.annotations.Table注释来指定,该注释除了javax.persistence.Table注释之外还使用:
@Entity
@javax.persistence.Table(name="Ranking")
@org.hibernate.annotations.Table(
    appliesTo="Ranking",
    indexes = { @Index(name="ranking_ix", columnNames = { "rankable", "criteria", "rank" } ) }
)
public class Ranking extends Model {
    @ManyToOne
    public Rankable rankable;

    @ManyToOne
    public Criteria criteria;

    @Index(name = "ranking_ix")
    public double rank;
}
    

要回复问题请先登录注册