In Grails (GORM), how to override a constraint name (in the generated dbm script). I am using Oracle with GORM. It seems the length of the constraint name is restricted to 15.
If there's no way to override then is there a way to alter the length to more than 15 (say 25)!!
e.g.
CREATE TABLE X (
id NUMBER(19,0) NOT NULL,
CONSTRAINT overridden_name_here
PRIMARY KEY (id));
Not sure if the latest Grails 3 provides a more direct way of customizing the constraint names, but in Grails 2.4.5 and earlier versions the way to go is with a custom configuration subclass.
It essentially involves creating your own configuration by extending GrailsAnnotationConfiguration and overriding the secondPassCompile() method. In this method you can access your domain class and access/set many different properties including something like the foreign key constraint name.
For a detailed example please see Burt Beckwith's post: http://burtbeckwith.com/blog/?p=465
I believe the length limit of the name for a constraint is determined by the underlying database implementation and not GORM itself.