[英]How to change the schema and name for intermediary table generated from relationships
I have some entities/tables which I would like to place together in a schema.我有一些实体/表,我想将它们放在一个模式中。 The intermediary tables from ManyToMany relationships are being generated in the public schema. ManyToMany 关系中的中间表正在公共模式中生成。 How do I change the name and schema for the generated table?如何更改生成的表的名称和架构?
@Entity
@Table(schema = "my_schema")
public class AnotherEntity {}
@Entity
@Table(schema = "my_schema")
public class MyEntity {
@ManyToMany
private List<AnotherEntity> entityRelationship;
}
Annotate the relationship with @JoinTable
:注释与@JoinTable
的关系:
@Entity
@Table(schema = "my_schema")
public class MyEntity {
@ManyToMany
@JoinTable(name="my_intermediary_table", schema="my_schema")
private List<AnotherEntity> entityRelationship;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.