Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where should I place a transient domain class in a grails app?

Where should I place a transient domain class in a grails app?

Ie I have an Action class that will be passed about, and used, but never saved. Should this be in the grails-app/domain folder, or somewhere else?

like image 700
C. Ross Avatar asked Feb 19 '11 15:02

C. Ross


1 Answers

grails-app/domain is for persistent domain classes, but not all of your application's domain-related classes need to be there, e.g. in this case where you want to use it as a value object. You can put these in src/groovy along with other classes that aren't considered Grails artifacts.

If you want the classes to support validation, you can annotate them with @Validateable - see section "7.5 Validation Non Domain and Command Object Classes" in the ref docs: http://grails.org/doc/latest/

like image 166
Burt Beckwith Avatar answered Oct 28 '22 10:10

Burt Beckwith