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

It is not possible to use the spring @Transactional anotation #684

Closed
filipenfst opened this issue May 18, 2023 · 7 comments
Closed

It is not possible to use the spring @Transactional anotation #684

filipenfst opened this issue May 18, 2023 · 7 comments
Labels
enhancement New feature or request P2

Comments

@filipenfst
Copy link

filipenfst commented May 18, 2023

If i try to use the @transactional annotation from spring i get the error

Could not open R2DBC Connection for transaction
org.springframework.transaction.CannotCreateTransactionException: Could not open R2DBC Connection for transaction
	(Coroutine boundary)
	at com.example.spannercontexterror.R2DBCSpannerErrors$transactionFailTest$1.invokeSuspend(R2DBCSpannerErrors.kt:65)
Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open R2DBC Connection for transaction
	at app//org.springframework.r2dbc.connection.R2dbcTransactionManager.lambda$doBegin$5(R2dbcTransactionManager.java:234)
	Suppressed: The stacktrace has been enhanced by Reactor, refer to additional information below: 
Assembly trace from producer [reactor.core.publisher.MonoError] :
	reactor.core.publisher.Mono.error(Mono.java:298)
	org.springframework.r2dbc.connection.R2dbcTransactionManager.lambda$doBegin$5(R2dbcTransactionManager.java:236)

To reproduce the error you can use the test transactionFailTest that you can find here https://github.com/filipenfst/spanner-context-error/blob/master/src/test/kotlin/com/example/spannercontexterror/R2DBCSpannerErrors.kt

The issue is cause by the begingTransaction method on the SpannerClientLibraryConnection class

  @Override
  public Publisher<Void> beginTransaction(TransactionDefinition definition) {
    return Mono.error(new UnsupportedOperationException());
  }
@burkedavison burkedavison added enhancement New feature or request P2 labels May 18, 2023
@meltsufin
Copy link
Member

Is it supposed to work with Spring Boot 2.7 and Spring Data R2DBC 1.5.6.? I don't see it documented as supported.

@filipenfst
Copy link
Author

I think it should be supported because there is not any documentation saying that it is not supported. How would i know that it does not work before starting using it if it is not documented? If that support is not implemented soon i will have to throw out 4 months of work and rewrite my service with any db that does not comes from google. That is a really bad position that you guys put me.

@meltsufin
Copy link
Member

@filipenfst
Copy link
Author

That information should be on the main project page https://github.com/GoogleCloudPlatform/cloud-spanner-r2dbc and here https://cloud.google.com/spanner/docs/use-oss-r2dbc not "hidden" only on the release notes. Those are what people first look at. But anyway, is there a plan to implement compatibility with spring? And what is the target date for that?

@meltsufin
Copy link
Member

Looks like a duplicate of #314.

@jainsahab
Copy link
Contributor

@burkedavison @meltsufin
Should we close this now, since #738 is addressing it?

@meltsufin
Copy link
Member

Fixed in #738.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2
Projects
None yet
Development

No branches or pull requests

4 participants