Search code examples
grailsgrails-orm

View grails domain class property in another domain class


Hi I am just trying out grails and trying to learn more on domain class. I have two simple domain classes:

Domain Class 1

package grailtest

class Person {

    String  firstName
    String  lastName
    int age
    String  email

    static constraints = {
    }

}

Domain Class 2

package grailtest

class Customer {

    String  customerId
    Person  personInCharge

    static constraints = {
    }

}

When I do a run-app, I can only see

grailtest.Person : 1

as the Person. How can I default it to a particular value, for instance firstName + lastName, to make the application more user friendly?


Solution

  • in the domain override toString method to what you wanted to be display. restart the app