简体   繁体   English

如何更改从关系生成的中间表的架构和名称

[英]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.

相关问题 如何更改从 JSON Schema 生成的 POJO 的格式? - How to change the format of POJOs generated from JSON Schema? 如何在 fastnate 生成的 SQL 中附加模式名称 - How to append schema name in the SQL generated by fastnate 在 Telosys 生成的代码中更改 JPA 注释中不同环境的模式名称 - Change schema name for different environment in JPA annotation in Telosys generated code 如何在PreparedStatement中更改from子句的表名 - How to change table name of from clause in PreparedStatement 这种“中介”模式的名称是什么? - What is the name of this 'intermediary' pattern? mybatis中间表映射 - mybatis intermediary table mapping 如何使生成的类包含XML Schema文档中的Javadoc - How to make generated classes contain Javadoc from XML Schema documentation 如何忽略特定模式在生成的jar中的导入模式中的类 - How to ignore classes from imported schemas in the generated jar for a particular schema wsimport - 没有名称空间的导入模式==&gt;名称为&#39;generated&#39;的包 - wsimport - Imported schema with no namespace ==> package with name 'generated' 如何从作为中间结果生成的字符串 stream 中获取字符串数组? - How to get a string array out of a string stream which gets generated as an intermediary result?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM