相关疑难解决方法(0)

如何在多列上创建索引

我们有以下实体关系,其中用户属于特定组织。我的查询看起来像“select * from User where org=:org”或“select * from User where org=:org and type=:type”

我在 User 类上有单独的索引。第一个查询会很好,因为外键元素上有索引。第二个查询是否要求在 org 和 type 列上使用多列索引。如果是这样,我应该如何注释来创建一个这样的索引。

@Entity 
class User {
...

@ManyToOne 
@ForeignKey
@Index
Organization org;

@Index
Type type;    
...
}
Run Code Online (Sandbox Code Playgroud)

mysql indexing orm hibernate jpa

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

hibernate ×1

indexing ×1

jpa ×1

mysql ×1

orm ×1