title: Grails - @Transactional, Connection is read-only
body: <p>I used static scaffolding to create CRUD-methods for my <code>Test</code> domain class. When using the created <code>TestController</code> only I had no problems whatsoever saving new <code>Test</code> objects. However, I wanted to extend the functionality and implemented a corresponding <code>TestService</code> class. Doing so I now always get an error on saving a <code>Test</code> object: <code>Connection is read-only. Queries leading to data modification are not allowed</code></p>
  
  <p>And here it started to malfunction. Following the code of <code>TestService</code>. If I understood it correctly, it would not be necessary to use the <code>@Transactional</code> annotation with the two <code>save</code> and <code>delete</code> methods as they would inherit that functionality directly from the class.</p>
  
  <pre><code>package test.services
  
  import grails.transaction.Transactional
  import test.Test
  
  @Transactional
  class TestService {
      @Transactional(readOnly = true)
      def tests() {
          Test.list()
      }
  
      @Transactional(readOnly = true)
      def count() {
          Test.count()
      }
  
      @Transactional
      def save(test) {
           test.save()
      }
  
      @Transactional
      def delete(test) {
          test.delete()
      }
  }
  </code></pre>
  
  <p>Here is also the code for saving a <code>Test</code> object in the <code>TestController</code>:</p>
  
  <pre><code>def save(Test test) {
      if (testInstance == null) {
          notFound()
          return
      }
  
      if (testInstance.hasErrors()) {
          respond testInstance.errors, view:'create'
          return
      }
  
      testService.save(testInstance)
  
      request.withFormat {
          form multipartForm {
              flash.message = message(code: 'default.created.message', args: [message(code: 'test.label', default: 'Test'), testInstance.id])
              redirect testInstance
          }
          '*' { respond testInstance, [status: CREATED] }
      }
  }
  </code></pre>
  
  <p>The only thing I changed is the line which states <code>testService.save(testInstance)</code>. Before that, the scaffolding process put <code>testInstance.save flush: true</code></p>
  
  <p>I don't really see a mistake. Especially, as another domain class' objects can be saved without problems using more or less the same configuration.</p>
  
  <p>Any help would be appreciated!</p>