gorm


GORM findAll + cannot pass dynamic List as named parameter


I am getting the following exception at the following HQL.
java.util.ArrayList cannot be cast to java.lang.String.
Obviously I'm missing something but can't, can't figure it out. Can somebody please advise?
def methodA(List<String> key1List, List<String> key2List){
def results = DomainX.findAll("from DomainX x where (x.key1 in (:key1_s)) and (x.key2 in (:key2_s))",[key1_s:key1List, key2_s:key2List])
}
The following works but not the above one:
def methodA(List<String> key1List, List<String> key2List){
def results = DomainX.findAll("from DomainX x where (x.key1 in (:key1_s)) and (x.key2 in (:key2_s))",[key1_s:['ABC'], key2_s:['DEF']])
}
It was my mistake. key2List was like [[key2_a], [key2_b]]; GORM was expecting this to be a flattened list [key2_a, key2_b].

Related Links

GORM findAll + cannot pass dynamic List as named parameter
How to display database records in grails
Configure Grails 3.0.9 for Oracle 12c with identity PK?
Adding condition to findAll and findAllBy methods
Neo4j and Mongodb as datasource in Grails
GORM (varchar .save(), non DATE): ORA-01861: literal does not match format string
GORM addTo methods not found in Spock test
spring-boot property exception while externalizing datasource properties and using actuator
Mapping hasMany relation and saving the related data
Method on class [] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails Correctly
What happens when two app servers in cluster start LiquiBase update (via Grails)?
use of mappedBy in Many to Many relationship in Grails
Domain class auto validation in grails
Grails Detached Criteria Query and “group by” and “having” clause
Script for saving large no of entries in mongodb
Does the multiple datasource feature of Grails 2.0 support relations?

Categories

HOME
netsuite
keycloak
cookies
tizen
jsp-tags
umd
ezpublish
azure-media-services
indesign
gnupg
izpack
apache-cayenne
phaser
try-catch
fatal-error
finite-automata
viewport
opencover
microsoft-r
angular2-aot
javacv
su
traffic
windows-error-reporting
atlassian-crucible
madlib
flink-streaming
r-raster
media-queries
yadcf
noraui
windows-dev-center
openoffice.org
language-concepts
amazon-kinesis-kpl
ios5
gesture
bootstrapper
azure-ml
greenrobot-eventbus
google-closure
no-www
eclipse-gef
businessworks
zip4j
boost-multi-index
alphabet
crypt
google-perftools
cudafy.net
query-performance
eventkit
xcb
android-fonts
log4c
url-masking
phishing
login-control
transmitfile
plottable.js
bstr
lua-5.1
hover-over
packagist
yaws
wso2cloud
comobject
wyam
sframe
ionic
microbenchmark
splash
sonarqube5.1.2
inmobi
javax.mail
nsmutabledictionary
issuu
googlemock
reactfx
ember-charts
terminal-services
quantlib-swig
ftps
easy-install
spring-validator
factory-method
specification-pattern
simba
venn-diagram
windows-phone-7.1.1
jquery-ui-layout
asyncfileupload
libc++
heartbeat
psi
netbeans-7.1
subviews
preference
yagni
anti-piracy

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App