我应该使用哪些注释来使用 Ebean 创建索引?

What annotations should i use to create indexes using Ebean?

我想在 table 中的某些列上创建索引。我正在使用 Ebean 和 Play-java。我想知道在 column/table.

上创建索引的正确注释是什么

有没有人成功地使用 JPA 注释建立索引?

注意:我知道我总是可以手动创建索引而不用担心注释。

Ebean 有@Index。请注意,在版本 6.5.1 中增强了支持 - https://github.com/ebean-orm/avaje-ebeanorm/issues/368

单列示例:

@Entity
@Table(name = "e_basic")
public class EBasic {

  ...

  @Index
  String name;

Multi-column 例子:

@Index(columnNames = {"last_name","first_name"})
@Entity
public class Contact {