Reputation: 1012
I am working with Grails application. I am using Apache Shiro security plugin for my grails application. I am trying to use findBy
query on my User
domain class with Or and And condition but it gives me an error.
My Domain Class
class ShiroUser {
String firstName
String lastName
String username
String email
String passwordHash
String userStatus
static hasMany = [ roles: ShiroRole, permissions: String ]
static constraints = {
username(nullable: false, blank: false, unique: true)
email(nullable: false, blank: false, email: true,unique: true)
}}
I have executed following query:
ShiroUser.findByUsernameOrEmailAndUserStatus(params?.username,params?.username,'Active')
I get following error:
Message: No property found for name [usernameOrEmail] for class [class com.chatportal.ShiroUser]
But If I execute query with only Or condition then it works fine.
ShiroUser.findByUsernameOrEmail(params?.username,params?.username)
Anyone please help me that what is wrong with my condition when I used Or and And condition with findBy ?
Upvotes: 0
Views: 1354