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

Allow to perform queries outside a db.transaction{ } block #25

Closed
sdeleuze opened this issue Mar 19, 2016 · 6 comments
Closed

Allow to perform queries outside a db.transaction{ } block #25

sdeleuze opened this issue Mar 19, 2016 · 6 comments

Comments

@sdeleuze
Copy link

In geospatial-messenger, I am currently forced to use db.transaction { } (see MessageRepository).

It would be nice if Exposed could make it possible to support existing transaction management system like the one provided by Spring (see this documentation and DataSourceTransactionManager Javadoc).

Exposed could maybe allow to set the default db to use at Table level, delegate the transaction management to any kind of other mechanism and allow to perform queries with Table.foo() functions without a wrapping them into a db.transaction{ } block.

My goal is to be able, potentially with some extensions, to be able to annotate service functions with @Transactional and just rely on our regular JDBC based transaction management (more details here).

@sdeleuze sdeleuze changed the title Support JDBC level transactions Allow to perform queries outside a db.transaction{ } block Mar 19, 2016
@Tapac
Copy link
Contributor

Tapac commented Apr 29, 2016

Implemented SpringTransactionManager class (subclass of spring DataSourceTransactionManager).
Please look at ExposedTransactionManagerTest.kt for example and feel free to report any problems.

@Tapac Tapac closed this as completed Apr 29, 2016
@sdeleuze
Copy link
Author

Thanks for adding such support.

I tried to update Geospatial Messenger project but I got a blocking error: IllegalStateException: Already value [org.jetbrains.exposed.sql.Transaction@3672276] for key [org.jetbrains.exposed.spring.SpringTransactionManager@255e5e2] bound to thread [main]. Maybe there is something to fix in SpringTransactionManager. See sdeleuze/geospatial-messenger@transactional

Please also make sure that spring-transaction will be deployed with the right groupId and version since I had to tweak Exposed build.gradle to be able to use org.jetbrains.exposed:spring-transaction:0.5.0-SNAPSHOT dependency.

Tapac added a commit that referenced this issue Mar 5, 2018
Fixed: IllegalStateException: "Already value"
@dragossusi
Copy link

What about multiplatform?

@Tapac
Copy link
Contributor

Tapac commented May 22, 2020

@dragossusi , how is it related to that issue?

@dragossusi
Copy link

My goal is to be able, potentially with some extensions, to be able to annotate service functions with @transactional and just rely on our regular JDBC based transaction management (more details here).

I thought he wants to use @transactional with exposed methods

@Tapac
Copy link
Contributor

Tapac commented May 22, 2020

Yes, it's possible with spring-transaction or exposed-spring-boot modules.

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

3 participants