0

So I am trying to execute the following query in grails

User user = springSecurityService.currentUser
def approverGroupList = approverGroupService.getApproverGroupsByUser(user.id)
return VerificationRequest.executeQuery("select distinct v.fundTransfer from VerificationRequest v where v.fundTransfer.creator.corporateHouse=:corporateHouse and v.verified = false and v.fundTransfer.status ='QUEUED' and v.approverGroup in (:approverGroupList)", [corporateHouse:corporateHouse],[approverGroupList:approverGroupList])

However I am getting the following exception :

/fund-transfer/list-verification-requests
Class
    org.hibernate.QueryException
Message
    Not all named parameters have been set: [approverGroupList] [select distinct v.fundTransfer from VerificationRequest v where v.fundTransfer.creator.corporateHouse=:corporateHouse and v.verified = false and v.fundTransfer.status ='QUEUED' and v.approverGroup in (:approverGroupList)]

Also corporateHouse is an object that's passes to the method executing this query and its not null. What could be the reason?

P.S. I am new to grails!

1
  • Let me guess: No all parameters have been set? Commented Aug 18, 2014 at 9:30

3 Answers 3

4

You've passed two maps to executeQuery:

VerificationRequest.executeQuery("...", [corporateHouse:corporateHouse],[approverGroupList:approverGroupList])

It should be one map with two values:

VerificationRequest.executeQuery("...", [corporateHouse:corporateHouse, approverGroupList:approverGroupList])

According to documentation the second map was taken as map with additional parameters.

Sign up to request clarification or add additional context in comments.

Comments

4

Looks like the parameters should be in one map, like this:

[corporateHouse:corporateHouse, approverGroupList:approverGroupList]

Comments

0

It means that you have not set all the parameters in the query. You have missed some check your query execution code

1 Comment

Can you point out where ? I see no error to be honest! But ofcourse I am totally new to grails!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.