0
votes

How to make relationship between two domain classes in grails . I already have one domain class from the plugin (spring security plugin) and i want to link USER domain class from plugin to the Profile domain class . What is the best way to do it?

1

1 Answers

6
votes

See the GORM documentation for a good overview. For a one-to-one relationship as I assume a profile would be, you could simply do the following:

class User {
    Profile profile
}

class Profile {
    // only needed if you need to refer to user from the Profile instance
    static belongsTo = [user:User] 
}