Sunday, December 5, 2010

Grails Domain Objects Across Schemas

The Grails documentation is very clear on how to specify specific table and column names for your domain classes (in Section 5.5.2 Custom ORM Mapping). But what if you need to specify the schema as well? Fortunately it is just as easy, if less well-documented.

Of course, when all of your domain tables are in the same schema, you should simply specify a default schema in DataSource.groovy. The property is hibernate.default_schema.