Stop Grails from opening a connection to the database in a Controller method -


i have service communicating machine. since it's simple controller method grails automatically grabs db connection pool while controller communicating other server. i'd prevent doing that, , manually open database connection when i'm ready doesn't suck connection during long period doing network calls. how prevent grails automatically grabbing connection pool in controller method?

when create controller has transactional annotation on it, like:

 @transactional(readonly=true)  class foocontroller { .. 

if remove annotation (and method level annotations) grails no longer connect database start transaction.

open session in view should not come play since use lazy init approach obtaining connection osiv

note answer above assumes using recent version of grails (2.3.x or above)

updated

for mongodb can disable automatically connection controllers defining following bean (which overrides default) in grails-app/conf/spring/resources.groovy:

 mongopersistenceinterceptor(org.codehaus.groovy.grails.support.nullpersistentcon‌​textinterceptor)  

however there no way disable on per controller basis @ moment


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -