JPA 2.1 Index annotation for columns with a function

后端 未结 1 1848
终归单人心
终归单人心 2021-01-18 18:28

In my Hibernate project, I add indices like so:

@Entity
@Table(name=\"MY_TABLE\", indexes = {
    @Index(name = \"idx_user_name\", columnList = \"name\"),
           


        
相关标签:
1条回答
  • 2021-01-18 18:43

    It is not possible to use a function based index in JPA 2.1.

    JPA provides means to abstract from a specific database. Every database has its own implementation of FBI which can vary greatly. Hence, it is not part of the standard.

    I peeked into the Hibernate code to see whether there might be an undocumented feature for a FBI. Unfortunately, only column based indexes are supported.

    You should run a SQL script on deployment to create your index.

    0 讨论(0)
提交回复
热议问题