The clear()
method will not actually do the work of deleting form the database you'll want to save after the clear()
. Try...
profile.licenceKeys.clear();
if (!profile.save(flash:true)) {
log.error ("Error occured removing licence keys from the database");
userProfile.errors.each { err -> println err; }
} else {
log.info("Successfully remove licence keys from the database");
}
For your second question you'll want to get the errors from the domain object that failed saving like so....
if (!profile.save(flash:true)) {
log.error ("Error occured removing licence keys from the database");
profile.errors.each { err -> println err; }
}