Grails is a boot process that starts whenever your application starts. His graceful; You can configure it for different actions in different environments.
One approach is to do the following in bootstrap:
1) csv, , .
2) , , doDomainObject.save()
.
, -
new File(filePath).splitEachLine(',') {fields ->
def domainObject = new YouDomainObject(
id: fields[0].trim(),
name: fields[1].trim()
)
if (domainObject.hasErrors() || domainObject.save(flush: true) == null) {
log.error("Could not import domainObject ${domainObject.errors}")
}
log.debug("Importing domainObject ${domainObject.toString()}")
}