The question is CLOSED as the error was while inserting a Staff
with a User
which was not heppening in proper way.(poor grails
didn't notify me.)
Above code works perfectly.
def createdBy = User.get(springSecurityService.principal.id)
def staff = Staff.findByUser(createdBy)
But, meanwhile implemented another way of finding Staff
in criteria way :
def createdBy = User.get(springSecurityService.principal.id)
def staff = staffCriteria.get{
user{
idEq(createdBy.id)
}
}