[英]Jhipster: How to create a relationship using a field not the id
I have 2 entities Country abd competions and i want to build a relationship betwenn them using the isoCode of the country, but when i generate the database(mySql) i find that the relation is based on the generated country_id. 我有2个实体Country abd竞争,我想使用国家的isoCode在它们之间建立关系,但是当我生成数据库(mySql)时,我发现该关系基于生成的country_id。 What i'm missing?
我想念的是什么? Can i specify my own id and remove the generated id from the jdl file?
我可以指定自己的ID并从jdl文件中删除生成的ID吗?
entity Country {
isoCode String required
.
.
}
entity Competition {
priority Integer,
code String,
name String
}
relationship OneToMany {
Country to Competition{country(isoCode)},
}
Thanks 谢谢
JHipster仅支持关系的技术ID,如果要使用业务ID,则必须手动对其进行编码,也许可以看看Hibernate @NaturalId
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.