我出現了一個我不明白的問題。下面的代碼不起作用:實體在EntityClass(Grails 3.3.0.RC1; Grom 6.1.5)中設置屬性時未保存
AccountingEntity accountingEntity = AccountingEntity.get(params.id);
accountingEntity.setLifecycleStatusToArchived();
accountingEntity.save(flush:true);
凡方法setLivecylceStatusToArchived樣子:
void setLifecycleStatusToArchived() {
this.lifecycleStatus = AccountingEntity.LIFECYCLE_ARCHIVED; //predefined static variable
this.considerForRankingJob = false;
this.dateArchived = new Date();
}
問題是,實體沒有更新。 當我事先使用accountingEntity.validate()時沒有驗證錯誤。
然而,此代碼的工作:
AccountingEntity accountingEntity = AccountingEntity.get(params.id);
accountingEntity.setDateArchived(new Date());
accountingEntity.setConsiderForRankingJob(false);
accountingEntity.setLifecycleStatus(AccountingEntity.LIFECYCLE_ARCHIVED);
accountingEntity.save(flush:true);
的代碼沒有,除非我跟着指南中的所有步驟從Grails的3.2.9更新後,任何工作更加3.3.0.RC1(http://docs.grails.org/3.3.x/guide/upgrading.html)和其餘的代碼工作正常(還有數據庫訪問等)
有沒有人有想法?問題可能是什麼?
在此先感謝和問候!
這是問題!謝謝! – Kloker