Last active
January 2, 2016 06:09
-
-
Save gokhanakgul/8261890 to your computer and use it in GitHub Desktop.
Create domain class instances dynamically and saves it
https://github.com/burtbeckwith (http://grails.1312388.n4.nabble.com/How-can-I-create-domain-class-instances-dynamically-td4631390.html)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void saveDomainClassProperties(String domainClassName, Map newProperties) { | |
log.info "domainClass : $domainClassName" | |
def domainClassInstance = grailsApplication.getDomainClass(domainClassName).newInstance() | |
domainClassInstance.properties = newProperties | |
domainClassInstance.save(flush: true) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment