0
votes

please help me

I have this class

Class Person
{
 String name
 String id
 Date date
}

This class is connected with mysql

my question is where put this:

Person.count() or Person.findByAllName("Carlos")

Class Person
{
 String name
 String id
 Date date
def person = Person.count() //here???
}

I want to create a field person that show how many register have the table.

is possible with scaffold only, because have error the moment of run app?

Thanks and sorry by my bad english¡¡¡

1

1 Answers

0
votes

The correct place would be outside the domain class. Also, you need not define the Id on the domain class, as it is autogenerated