Browse Source

Wrap db reads in read only transaction

Lari Hotari 11 years ago
parent
commit
c2fbb3913c
1 changed files with 2 additions and 0 deletions
  1. 2 0
      grails/hello/grails-app/controllers/hello/HelloController.groovy

+ 2 - 0
grails/hello/grails-app/controllers/hello/HelloController.groovy

@@ -1,6 +1,7 @@
 package hello
 
 import grails.converters.JSON
+import grails.transaction.Transactional
 import groovy.transform.CompileStatic
 import java.util.concurrent.ThreadLocalRandom
 
@@ -14,6 +15,7 @@ class HelloController {
       render msg as JSON
     }
 
+    @Transactional(readOnly=true)
     def db(int queries) {
       if(queries < 1) queries=1
       def worlds = new ArrayList(queries)