Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where should Grails Command objects be placed in the project structure?

I have a class called LoginCommand in domain/my/package/name

class LoginCommand {

    String emailAddress
    String password

}

My question is why is a table be auto generated in my database for a ***Command object in grails? Are these command objects supposed to be placed ouside of /domain to avoid auto generation of a table by hibernate/orm.

like image 765
benstpierre Avatar asked Apr 15 '13 20:04

benstpierre


Video Answer


1 Answers

They should not go in grails-app/domain; they are not domain classes. Place them in src/groovy. Alternatively, a common convention is to put the command class in the same file as the controller that uses it.

Take a look at the Convention Over Configuration section in the grails manual to get an idea of what goes where.

like image 197
ataylor Avatar answered Sep 24 '22 19:09

ataylor