Quantcast

use grailsApplication.config in static namedQueries

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

use grailsApplication.config in static namedQueries

Matti van Aert
Hi,

I'd like to use my grailsApplication.config properties in a static namedQueries. I'm using grails 1.3.7, is this possible?

--
Met vriendelijke groet,
 
Matti van Aert

Achter de Molen 45
4873 GW Etten-Leur
M: +31 (0)6 5499 4867

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: use grailsApplication.config in static namedQueries

Nathan Wells

I'm pretty sure that's not possible in any version of Grails. Can you parameterize named queries?

On Aug 2, 2012 7:41 AM, "Matti van Aert" <[hidden email]> wrote:
Hi,

I'd like to use my grailsApplication.config properties in a static namedQueries. I'm using grails 1.3.7, is this possible?

--
Met vriendelijke groet,
 
Matti van Aert

Achter de Molen 45
4873 GW Etten-Leur
M: <a href="tel:%2B31%20%280%296%205499%204867" value="+31654994867" target="_blank">+31 (0)6 5499 4867

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: use grailsApplication.config in static namedQueries

pledbrook
In reply to this post by Matti van Aert
> I'd like to use my grailsApplication.config properties in a static
> namedQueries. I'm using grails 1.3.7, is this possible?

No. Ideally all 'static' contexts in Grails would have the
grailsApplication bean available to them, but that's not the case.

What you could do is create your own static configuration holder class
and initialise it in BootStrap.groovy. Yes, it's not good "practice"
but it solves the problem with ConfigurationHolder since your own
class is private to your own web application. The biggest problem with
ConfigurationHolder is that the class and it's data can easily be
shared between multiple Grails applications in the same VM.

Hope that helps,

Peter

--
Peter Ledbrook
Grails Advocate
SpringSource - A Division of VMware

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Loading...