EclipseLink - 向 Postgres 添加索引

EclipseLink - adding indexing to Postgress

我想为现有实体添加索引,具体是在特定列上。在文档之后我写了类似的东西:

1.first way
@Entity
@Table(name = "potatoe", schema = "mySchema")
public class Potatoe {
(...)
@Index(name = "knife", table = "potatoe", schema = "mySchema")
    private String origin;
(...)
}

2.second way
@Entity
@Table(name = "potatoe", schema = "mySchema")
@Index(name = "knife", columnNames = "origin", table = "potatoe", schema = "mySchema")
public class Potatoe {
(...)
    private String origin;
(...)
}

 3. third way(pure jpa)
    @Entity
    @Table(name = "potatoe", schema = "mySchema", indexes = {@javax.persistence.Index(name = "knife", columnList = "origin")})
    public class Potatoe {
    (...)
        private String origin;
    (...)
    }

但是没有用,INDEX 没有创建。我总是有例外:

Caused by: org.postgresql.util.PSQLException: ERROR: error in syntax or/in near "."

EclipseLink 创建的查询是

CREATE INDEX myschema.knife ON potatoe (ORIGIN)]]

而且我不知道他为什么要更改索引的名称。为什么 eclipseLink 添加带有点的模式来命名?我想这个“。”以索引制作问题的名义,但我不知道如何删除它。

我正在使用 eclipselink ver 2.5.0 和 postgresql ver 9.1-901。

编辑// 当我删除属性 "schema" 时,eclipselink 正确创建查询:

CREATE INDEX knife ON potatoe (ORIGIN)]]

但问题是我必须定义模式,因为我有一些。因此,如果没有定义模式,它就会出现关于关系的错误(关系不存在)。所以这是真的,因为我的默认关系不是 "myschema".

我检查了 Postgres,工作查询如下所示,但我不知道如何生成它:

CREATE INDEX knife ON myschema.potatoe (ORIGIN)

有人知道吗?

我确实找不到 schema defining for table in docs 试试猴子黑客:

@Index(name = "knife", columnNames = "origin", table = "myschema.potatoe")