私はgrailsでドメインクラスを持っています...どのようにして、dbを作成するときにこのエンティティを削除するようにしますか?ちょうどそれを残す。Grails Entity without persist
答えて
あなたはドメインクラスである必要はありません。 src/groovyファイルにPOGOを作成するだけです。私の前提が間違っている場合は、あなたが達成しようとしていることをさらに説明してください。
コマンドオブジェクトを使用できます。
http://grails.org/doc/latest/guide/single.html#commandObjects
彼らはデータバインディングとドメインクラスの検証を提供しますが、データベースにマップされません。
私が理解すれば、ドメインクラスからテーブルを作成したくないのですか?はいの場合は、ドメインクラス内で次のコードを使用してください。
static mapWith = "none" // disable persisting into database
この質問に対するその他の回答はうまく役立ちますが、これは厳密には質問に対する正解です。 – scrotty
'mapWith'のデフォルト値は' 'GORM" 'です。 [grailsソース](https://github.com/grails/grails-core/blob/31af2108f171534edca3f6f15391364ee1fb2641/grails-core/src/main/groovy/org/grails/core/DefaultGrailsDomainClass.java)を参照してください。 – GreenGiant
- 1. HibernateカスケードPERSIST
- 2. Persist FileUploadコントロール値
- 3. Persist Facebookアクセストークン
- 4. webrtc2sip configuration without sipml5
- 5. Ember Ember Without Ember?
- 6. Oracle expdp without data
- 7. numpy unique without sort
- 8. JavaFx FileChooser without stage
- 9. QApplication without display
- 10. isomorphic react.js without flux
- 11. c#Directory.GetDirectories without folders
- 12. npm install without ssl
- 13. std :: sort without functors
- 14. Django Formset without instance
- 15. TabControl ItemTemplate without ItemsSource
- 16. Git Branches without Pulling
- 17. Doctrine2 strange persist例外
- 18. RouteLinkのPersist QueryStringパラメータ
- 19. OAuth&Access Token Persist Question
- 20. Android Add Transaction without Transaction
- 21. php Zend/MVC without mod_rewrite
- 22. Heroku-Git push without building
- 23. git merge without auto commit
- 24. django update version without pip
- 25. jekyll serve(local)without building
- 26. JPA persistはGenerationType.IDENTITYで失敗する
- 27. Hibernate 3.6 + JPA2 + Guice-persist + Maven
- 28. Spring-Hibernate persistが挿入されない
- 29. Doctrine 2、コードを実行する必要がありますpre-persist/post-persist
- 30. Ruby on Rails ambethia recaptcha without model
コマンドオブジェクトが検証可能になるという副作用を利用しています。 src/groovyクラスを作成し、 'grails.validation.Validateable'を使って注釈を付ける方が良いでしょう –
コマンドオブジェクトのGrailsドキュメントは、検証機能に特に注意するので、副作用として扱われているようには見えません。 – Patrick
コマンドオブジェクトをコントローラに宣言して、コマンドオブジェクトにする必要があります。コマンドオブジェクトとして使用せずに、非永続ドメインクラスとしての検証機能を利用するだけでは、それは副作用です。 –