Mapping two domain classes in Grails
问题 I have two tables in our database that need mapped. The first is a Student table. It looks something like this: id first_name last_name major_code_1 major_code_2 And the Major table is like this: id description I need to map the major codes of the student, where major_code_1 and major_code_2 point to an id in the Major table. How could I do this? Thanks! 回答1: Here is a simple model which maps to your schema: class Student { String firstName String lastName Major firstMajor Major secondMajor