GORM Inheritance Mapping
A really nice feature of GORM (and Hibernate) is support for inheritance in domain objects. For example if your application has different types of user accounts with specific properties then you can create distinct domain objects that inherit from a User base class that has all the common properties of a user (email, password, etc). Here’s what it might look like if you had a student user type and an admin user type:
Because of the tablePerHierarchy set in the user mapping this will result in 3 seperate tables (user, admin_user, and student). Omit this if you’d like all the fields to be contained within a single user table.
If you store the user object in session after authentication you can write code like this in your view:
See also: