java - What could the reason of the exception 'org.hibernate.QueryException Message Not all named parameters have been set:' possibly be? -


so trying execute following query in grails

user user = springsecurityservice.currentuser def approvergrouplist = approvergroupservice.getapprovergroupsbyuser(user.id) return verificationrequest.executequery("select distinct v.fundtransfer verificationrequest v v.fundtransfer.creator.corporatehouse=:corporatehouse , v.verified = false , v.fundtransfer.status ='queued' , v.approvergroup in (:approvergrouplist)", [corporatehouse:corporatehouse],[approvergrouplist:approvergrouplist]) 

however getting following exception :

/fund-transfer/list-verification-requests class     org.hibernate.queryexception message     not named parameters have been set: [approvergrouplist] [select distinct v.fundtransfer verificationrequest v v.fundtransfer.creator.corporatehouse=:corporatehouse , v.verified = false , v.fundtransfer.status ='queued' , v.approvergroup in (:approvergrouplist)] 

also corporatehouse object that's passes method executing query , not null. reason?

p.s. new grails!

you've passed 2 maps executequery:

verificationrequest.executequery("...", [corporatehouse:corporatehouse],[approvergrouplist:approvergrouplist]) 

it should 1 map 2 values:

verificationrequest.executequery("...", [corporatehouse:corporatehouse, approvergrouplist:approvergrouplist]) 

according documentation second map taken map additional parameters.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -