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

Support suspending functions annotated with @Transactional #23575

Closed
sdeleuze opened this issue Sep 3, 2019 · 4 comments
Closed

Support suspending functions annotated with @Transactional #23575

sdeleuze opened this issue Sep 3, 2019 · 4 comments
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@sdeleuze
Copy link
Contributor

sdeleuze commented Sep 3, 2019

As a follow-up of #22915, this issue is about supporting suspending functions annotated with @Transactional. It seems not straightforward to call CoroutinesUtils.invokeHandlerMethod(method: Method, bean: Any, vararg args: Any?): Any? from TransactionAspectSupport.ReactiveTransactionSupport#invokeWithinTransaction where we deal with a parameter-less InvocationCallback.

@sdeleuze sdeleuze added the in: data Issues in data modules (jdbc, orm, oxm, tx) label Sep 3, 2019
@sdeleuze sdeleuze added this to the 5.x Backlog milestone Sep 3, 2019
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Sep 3, 2019
This commits adds Coroutines extensions for
TransactionalOperator.transactional that accept suspending lambda or
Kotlin Flow parameters.

@transactional on suspending functions is not supported yet, spring-projectsgh-23575
has been created for that purpose.

This commit also renames invokeHandlerMethod to invokeSuspendingFunction
in CoroutinesUtils.

Closes spring-projectsgh-22915
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Sep 3, 2019
This commits adds Coroutines extensions for
TransactionalOperator.transactional that accept suspending lambda or
Kotlin Flow parameters.

@transactional on suspending functions is not supported yet, spring-projectsgh-23575
has been created for that purpose.

This commit also renames invokeHandlerMethod to invokeSuspendingFunction
in CoroutinesUtils.

Closes spring-projectsgh-22915
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Sep 3, 2019
This commits adds Coroutines extensions for
TransactionalOperator.transactional that accept suspending lambda or
Kotlin Flow parameters.

@transactional on suspending functions is not supported yet, spring-projectsgh-23575
has been created for that purpose.

Closes spring-projectsgh-22915
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Sep 3, 2019
This commit adds Coroutines extensions for
TransactionalOperator.transactional that accept suspending lambda or
Kotlin Flow parameters.

@transactional on suspending functions is not supported yet, spring-projectsgh-23575
has been created for that purpose.

Closes spring-projectsgh-22915
@sdeleuze sdeleuze self-assigned this Sep 9, 2019
@sdeleuze
Copy link
Contributor Author

sdeleuze commented Sep 9, 2019

It looks like I won't have the bandwidth to do that for Spring Framework 5.2, so this is a good candidate for Spring Framework 5.3.

@sdeleuze sdeleuze modified the milestones: 5.x Backlog, 5.3 M1 Sep 9, 2019
@rstoyanchev rstoyanchev added the type: enhancement A general enhancement label Nov 15, 2019
@jhoeller jhoeller modified the milestones: 5.3 M1, 5.3 M2 Feb 24, 2020
@ghost
Copy link

ghost commented Mar 23, 2020

This feature would be really nice. 👍

@davidb-e4s
Copy link

davidb-e4s commented May 19, 2020

Is there a workaround for this? While we wait for @transactional support apart from manually rolling back.

@sdeleuze
Copy link
Contributor Author

For now you can use the programmatic variant via TransactionalOperator Coroutines extensions.

@jhoeller jhoeller modified the milestones: 5.3 M2, 5.3 RC1 Aug 7, 2020
@sdeleuze sdeleuze modified the milestones: 5.3 RC1, 5.3 RC2 Aug 26, 2020
@sdeleuze sdeleuze modified the milestones: 5.3 RC2, 5.3 GA Oct 12, 2020
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Oct 25, 2020
This commit makes TransactionInterceptor and TransactionAspectSupport
Coroutines aware, adapting Reactive transaction support to Coroutines.

Suspending functions returning a Flow are handled like Flux, for other
return types the are handled like Mono.

Closes spring-projectsgh-23575
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Oct 25, 2020
This commit makes TransactionInterceptor and TransactionAspectSupport
Coroutines aware, adapting Reactive transaction support to Coroutines.

Suspending functions returning a Flow are handled like Flux, for other
return types, they are handled like Mono.

Closes spring-projectsgh-23575
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Oct 25, 2020
This commit makes TransactionInterceptor and TransactionAspectSupport
Coroutines aware, adapting Reactive transaction support to Coroutines.

Suspending functions returning a Flow are handled like Flux, for other
return types, they are handled like Mono.

Closes spring-projectsgh-23575
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants