I have the following class
class SentryUser {
transient springSecurityService
String userName
String password
boolean enabled
boolean accountExpired = false
boolean accountLocked = false
boolean passwordExpired = false
static constraints = {
userName blank: false, unique: true
password blank: false
}
static mapping = {
password column: '`password`'
}
Set<SentryRole> getAuthorities() {
SentryUserSentryRole.findAllBySentryUser(this).collect { it.sentryRole } as Set
}
def beforeInsert() {
encodePassword()
}
def beforeUpdate() {
if (isDirty('password')) {
encodePassword()
}
}
protected void encodePassword() {
password = springSecurityService.encodePassword(password)
}
}
I’m calling the following code in bootstrap
def admin = new SentryUser(userName: "sample@sample.com",
enabled: true).save(failOnError: true)
and getting the following error
context.GrailsContextLoader Error executing bootstraps: groovy.lang.MissingMethodException: No signature of method: SentryUser.save() is applicable for argument types: () values: []
I’m on grails 2.1.1 and using the spring security plugin.
You’re calling
save(Map)but the MME is complaining aboutsave()with no arguments. I’ve seen this discrepancy before when I didn’t have any persistence plugins (hibernate/mongodb) installed in my application – it was a plugin project that I was trying to run as a standalone app and the default BuildConfig for a new plugin project doesn’t include a dependency on hibernate.