簡體   English   中英

Jhipster:如何使用字段而不是ID創建關系

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

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM