Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job calling a service ignores @Transactinal annotations #82

Open
erichelgeson opened this issue Jan 24, 2017 · 0 comments
Open

Job calling a service ignores @Transactinal annotations #82

erichelgeson opened this issue Jan 24, 2017 · 0 comments

Comments

@erichelgeson
Copy link

erichelgeson commented Jan 24, 2017

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. }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant