Reputation: 596
Suppose I have the following domain class:
class DomainClass{
String field1
...
static mapping = {
field1 defaultValue: "'Field1'"
...
}
}
Now I want to save the DomainClass instance using the "defaultValue", in the same way when using a sql insert into a postgresql (INSERT INTO domain_class VALUES(default, field2, field3, ...)), e.g.
DomainClass dc = new DomainClass()
dc.field1 = "defaultValue"
...
dc.save()
Upvotes: 0
Views: 86
Reputation: 27200
You can do this...
class DomainClass{
String field1 = "some default value"
// ...
}
Upvotes: 3