Last updated by sshucker 2 years ago
Introduction
This plugin adds extra options to the mapping closure in GORM domain classes. It includes a few mappings with the plugin, but it also provides the infrastructure for you to easily add mapping extensions in your own code.Setup and Installation
Install the plugin with the command:grails install-plugin extended-gorm-mappings
Built-in mappings
| Mapping | Data Type | Description |
|---|---|---|
| insertable | boolean | controls whether this column is included in INSERT statements |
| updateable | boolean | controls whether this column is included in UPDATE statements |
| formula | string | provides a SQL formula to be used in SELECT statements instead of binding this field to a database column. Implicitly makes the column read-only |
How it works
Grails builds a Configuration and then uses that Configuration to create a SessionFactory. This plugin extends grail's ConfigurableLocalSessionFactoryBean and modifies the hibernate Configuration just before the SessionFactory is built.Creating your own mappings
Rather than hardcode a list of mapping extensions, this plugin queries the application context for any beans that implement the interfacepackage org.riskfactor.grails.gorm; import org.hibernate.mapping.Property;public interface GormExtension { void extend(Property prop, Object setting); String getKey(); }



