Using id generator "select"


New member
I have a legacy Oracle database schema that I am generating a Grails application to support. One table has a primary key that is generated by the database, and grails/hibernate just has to retrieve it after the record is created and saved. This sounds like what the "select" generator is supposed to do (ala hibernate docs), but the code seems to compile it as a "sequence" generator - There is a database error that the "sequence does not exist".
The hibernate docs suggest setting "", but I'm not sure where to do this in Grails. Here is the domain groovy file. view and controller are auto-generated at this point.
Thanks for any help.
- Woody
package detail_maint

class WorkGroups {

Integer id
// Integer Work_Group_ID // NOT NULL NUMBER(5)
String Work_Group_Name // NOT NULL VARCHAR2(30)
String Work_Group_Desc // VARCHAR2(240)
Integer Parent_Wk_Grp_ID // NUMBER(5)
String Print_Order // VARCHAR2(3)
Integer Application_ID // NUMBER(5)

static constraints = {
Work_Group_Name (blank: false, nullable: false)
static mapping = {
table (name: 'CAENBIZ.WORK_GROUPS')
version false
columns {
id generator: 'select', column: 'WORK_GROUP_ID', type: 'integer'
Work_Group_Name (column: 'WORK_GROUP_NAME')
Work_Group_Desc (column: 'WORK_GROUP_DESC')
Parent_Wk_Grp_ID (column: 'PARENT_WK_GRP_ID')
Print_Order (column: 'PRINT_ORDER')
Application_ID (column: 'APPLICATION_ID')
Last edited:


New member
Since the generated Grails code wanted a sequence, I created one with the given name,
and permitted the new sequence to the connecting account.

It now saves the record correctly, but complains that it can't find the record with an ID
equal to the sequence value generated by the new sequence.

Of course the record is there, but with the ID generated by the trigger, not the sequence.
How can I generate Grails code that doesn't expect a sequence?