Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I call a Grails namedQuery on a particular datasource?

I have a small Grails application. I have decided to make a multi tenant architecture. I have several dataSources defined in DataSource.groovy.

The problem is I have defined several namedQueries in my Domain Model classes.

Trying to call:

Pomelo.one.matchByOneParam("paramValue").list() 

does not seem to work.

I get

groovy.lang.MissingMethodException
No signature of method: Pomelo.matchByOneValue() is applicable for argument types: (java.lang.String) 

I understand the error but I need to find a way to call these queries depending on the dataSource.

Is there a correct syntax for this or is this feature not supported yet ?

like image 636
ionutab Avatar asked Dec 04 '25 12:12

ionutab


1 Answers

I have also faced this issue a few months back and have not got any working solution, but found this Grails JIRA issue that haven't been resolved yet. And finally I use workaround mentioned in the issue, createCriteria.

like image 131
MKB Avatar answered Dec 07 '25 15:12

MKB