And let us say, continuing this thought, that I have my Grails application working with HSQLDB or MySQL, but the IT department says I must use a commercial software package (written by a large corp in Redwood Shores, Calif.).

Does this change make my web application nobbled in development and test environments? MySQL supports autoincrement on a primary key column but does support sequence objects, for example.

Is there a cleaner way to implement this sort of 'only when in production mode' without loading up the domain class?

1 Answer
1

This question (re: sequences) is more related to Hibernate than Grails -- and is well documented on our site

There are typically several reasons that the 'IT department says I must use a commercial software package'.... Among these are naming standards for database objects such as views, tables, even columns.

Another reason would be a standard such as 'every table must have its own sequence' that is a common (oft over-used) practice to assure ids for objects fall in certain ranges.
To accomplish this you could add a static mapping block for the renames, e.g. COMMENT becomes COMMENT_TBL and subclass the Hibernate Dialect for the database you are using.

N.B.: ORACLE-specific id generator in mapping closure are now ignored by the Grails 1.2.x framework, so this question is not relevant to recent versions. See JIRA
for some background on this question - and orig recommendation here. Keep in mind if you just wanted the one-sequence-per-table approach you could only use the subclass Oracle10gDialect as recommended by the hibernate community , specifically Rob Hasselbaum: