![](/img/trans.png)
[英]How to change the name and value of default ID field of an entity in jhipster
[英]Jhipster: How to create a relationship using a field not the id
我有2个实体Country abd竞争,我想使用国家的isoCode在它们之间建立关系,但是当我生成数据库(mySql)时,我发现该关系基于生成的country_id。 我想念的是什么? 我可以指定自己的ID并从jdl文件中删除生成的ID吗?
entity Country {
isoCode String required
.
.
}
entity Competition {
priority Integer,
code String,
name String
}
relationship OneToMany {
Country to Competition{country(isoCode)},
}
谢谢
JHipster仅支持关系的技术ID,如果要使用业务ID,则必须手动对其进行编码,也许可以看看Hibernate @NaturalId
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.