What could be the reason for the exception "org.hibernate.QueryException message does not set all named parameters:"?


Mrita

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])

But I get 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)]

CorporateHouse is also the object passed to the method that executes this query, and that object is not null. What could be the reason?

PS I'm new to grails!

PawełPiecyk

You have passed two maps to executeQuery:

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

It should be a map with two values:

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

According to the documentation , the second map is treated as a map with additional parameters.

Related


What could be the reason for this NullPointer exception?

Jim Below is part of my code. I got a NullPointerException at the line "buckets[i][h.hashBands(sum, bandRows)].add(j);". What could be the reason? public static void generateBuckets() { hash h = new hash(); buckets = new ArrayList[bands][bandRows];

What could be the reason for this NullPointer exception?

Jim Below is part of my code. I got a NullPointerException at the line "buckets[i][h.hashBands(sum, bandRows)].add(j);". What could be the reason? public static void generateBuckets() { hash h = new hash(); buckets = new ArrayList[bands][bandRows];

What is the reason for using exception chaining

Peter Cotaba I've been reading about exception chains recently and I'm not sure when I should use this syntax and for what reasons. I'm used to this pattern: try: my_function() exception MyError: my_logger.exception("Error occured") raise MyProcess

What is the reason for using exception chaining

Peter Cotaba I've been reading about exception chains recently and I'm not sure when I should use this syntax and for what reasons. I'm used to this pattern: try: my_function() exception MyError: my_logger.exception("Error occured") raise MyProcess

What could be the reason why Spring STS hangs?

User710818: Sometimes STS hangs at the beginning. Is it possible to find the reason? Maybe there is a log or maybe start in debug mode? Also, how do I differentiate between hanging completely and working very slowly? thanks. PS how to solve it? Stacker: Usuall

What could be the reason for Microsoft to phase out SmtpClient?

Luke In the .NET Framework 4.7 documentation, Microsoft SmtpClientmarked it as obsolete for the following reasons : SmtpClient and its type of network are poorly designed, we strongly recommend that you use https://github.com/jstedfast/MailKit and https://gith

What could be the reason why Spring STS hangs?

User710818: Sometimes STS hangs at the beginning. Is it possible to find the reason? Maybe there is a log or maybe start in debug mode? Also, how do I differentiate between hanging completely and working very slowly? thanks. PS how to solve it? Stacker: Usuall

hMatrix breaks the file, what could be the reason?

tian I've been using the hMatrix package in a ghci environment and everything works fine (e.g. I can import Numeric.LinearAlgebra.HMatrix). However, when I try to import and utilize the same thing in a script, everything breaks (I've slightly abridged the erro

What could be the reason for Microsoft to phase out SmtpClient?

Luke In the .NET Framework 4.7 documentation, Microsoft SmtpClientmarked it as obsolete for the following reasons : SmtpClient and its type of network are poorly designed, we strongly recommend that you use https://github.com/jstedfast/MailKit and https://gith

What could be the reason for the screen flickering briefly

Andreas I recently put together a new computer and bought two new screens. The screens (two 4K Asus PB279Qs) are each connected to a video card (EVGA GeForce 980Ti) via DisplayPort. To achieve 60 Hz, I set the display and video card to use Display Port 1.2 mod

What could be the reason why Spring STS hangs?

User710818: Sometimes STS hangs at the beginning. Is it possible to find the reason? Maybe there is a log or maybe start in debug mode? Also, how do I differentiate between hanging completely and working very slowly? thanks. PS how to solve it? Stacker: Usuall

hMatrix breaks the file, what could be the reason?

tian I've been using the hMatrix package in a ghci environment and everything works fine (e.g. I can import Numeric.LinearAlgebra.HMatrix). However, when I try to import and utilize the same thing in a script, everything breaks (I've slightly abridged the erro

What could be the reason for Microsoft to phase out SmtpClient?

Luke In the .NET Framework 4.7 documentation, Microsoft SmtpClientmarked it as obsolete for the following reasons : SmtpClient and its type of network are poorly designed, we strongly recommend that you use https://github.com/jstedfast/MailKit and https://gith

What could be the reason for the screen flickering briefly

Andreas I recently put together a new computer and bought two new screens. The screens (two 4K Asus PB279Qs) are each connected to a video card (EVGA GeForce 980Ti) via DisplayPort. To achieve 60 Hz, I set the display and video card to use Display Port 1.2 mod