Home Is there a way to use the mapping GORM 6 "defaultValue" when saving a domain instance
Reply: 0

Is there a way to use the mapping GORM 6 "defaultValue" when saving a domain instance

user549
1#
user549 Published in April 26, 2018, 1:46 pm

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()
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.347549 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO