Skip to content

Job calling a service ignores @Transactinal annotations #82

Closed

Description

@erichelgeson

Job:

class ExampleJob {
  def someService
  void execute() {
    someService.method()
  }
}

Service:

@Transactional
class SomeService {
  @Transactional(readOnly=true)
  def method() {
    // do lots work
  }
}

I would expect method called from the job would be a readOnly transaction. I only noticed it wasn't while I had sql logging on and noticed a bunch of dirty checks/updates.

It seems to ignore the annotation, adding Propagation.REQUIRES_NEW was not honored either.

If this same someService.method() is called from a controller it was readOnly as expected.

Only way to work around it was to not use the annotation but do Domain.withNewTransaction(readOnly: true) { .work. }

Activity

  1. jdaugherty commented on Aug 22, 2026

    @jdaugherty
    Contributor

    With the transforms now being AST based, this is n olonger true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions