2
我使用最新版本的jhipster到目前爲止(3.6.1),它使用MongoBee進行mongodb遷移。我想知道在MongoBee遷移類中使用spring數據存儲庫或MongoTemplate的後果在Mongobee遷移中使用存儲庫
我不想使用數據庫類,因爲我必須像下面那樣將我的屬性名稱寫爲字符串。所以我想用我的實體(文檔),並使用setter。
@ChangeSet(order = "01", author = "initiator", id = "01-addAuthorities")
public void addAuthorities(DB db) {
DBCollection authorityCollection = db.getCollection("jhi_authority");
authorityCollection.insert(
BasicDBObjectBuilder.start()
.add("_id", "ROLE_ADMIN")
.get());
authorityCollection.insert(
BasicDBObjectBuilder.start()
.add("_id", "ROLE_USER")
.get());
}
那麼另一個問題是,如果我使用的實體在DB保存,如果我申請變更後的實體更改屬性名會發生什麼?
@juliendubois我問這個問題在你的Twitter和你告訴我在StackOverflow上
謝謝你的回覆,那麼我的第二部分問題呢? '所以,另一個問題是,如果我使用實體保存在數據庫中,如果在應用變更集後更改了實體中的屬性名稱,會發生什麼情況? –
您可以問另一個問題嗎? StackOverflow規則每次都有一個問題... –