How to create indexes on multiple columns

后端 未结 3 1471
孤街浪徒
孤街浪徒 2021-01-20 16:55

We have the following entity relationships where a User belongs to a particular Organization. My queries either look like \"select * from User where org=:org\" or \"select *

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-20 17:32

    Yes, it is possible using JPA 2.1 as seen in the specification here:

    http://download.oracle.com/otndocs/jcp/persistence-2_1-pfd-spec/index.html

    on page 445 it states that

    The Index annotation is used in schema generation

    columnList (Required) The names of the columns to be included in the index.

    An example of usage can be seen here:

    http://java-persistence-performance.blogspot.co.uk/2013/03/but-what-if-im-not-querying-by-id.html

    It seems that the syntax is the same or very similar to Hibernate.

提交回复
热议问题