Cannot use multi transactions?
See original GitHub issueI am trying to use Exposed with SpringBoot and MySQL.
When I use two transaction
s, First transaction is executed.
But second transaction is ignored without errors.
Can I use multi transactions?
example
This is based on a tutorial of Spting Boot. https://spring.io/guides/tutorials/spring-boot-kotlin/
@RestController
@RequestMapping("/api/article")
class ArticleController() {
@GetMapping("/test")
fun test(): List<String> {
transaction {
User.insert {
it[login] = "no1_" + java.lang.Math.random()
it[firstname] = "one"
it[lastname] = "one"
it[description] = Date().toString()
}
}
transaction {
User.insert {
it[login] = "no2_" + java.lang.Math.random()
it[firstname] = "two"
it[lastname] = "two"
it[description] = Date().toString()
}
}
return listOf<String>("test")
}
mysql> select * from User;
+----+------------------------+-----------+----------+------------------------------+
| id | login | firstname | lastname | description |
+----+------------------------+-----------+----------+------------------------------+
| 17 | no1_0.9963653238062685 | one | one | Mon Mar 09 13:01:29 JST 2020 |
+----+------------------------+-----------+----------+------------------------------+
When I tried again, I got error java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30001ms.
.
That looks waiting for transaction to be committed.
environments
implementation("org.jetbrains.exposed:exposed-spring-boot-starter:0.21.1")
implementation("org.jetbrains.exposed:exposed-java-time:0.21.1")
implementation("mysql:mysql-connector-java:8.0.19")
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Warning: You cannot use more than one AR or AP account in ...
If you have multiple A/R or A/P accounts and you recorded a transaction to the incorrect account, you need to correct the original...
Read more >Can't process transactions in multi-user environment - Office
When one or more users process many transactions in a multi-user environment, the transactions may fail with the following error message:.
Read more >c# - Multiple TransactionScope problem - Stack Overflow
I think you'll find the specific answer is that you cannot complete a transaction that hasn't begun anything, it's in an invalid state....
Read more >Multi-statement transactions | BigQuery - Google Cloud
You can run multi-statement transactions over multiple queries in a session. To start a transaction, use the BEGIN TRANSACTION statement.
Read more >13.3.1 START TRANSACTION, COMMIT, and ROLLBACK ...
You cannot use ROLLBACK to undo the effect; however, if an error occurs during statement ... To specify multiple modifiers, separate them by...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for a sample it was very helpful. Now I found and fixed the issue and it will be available in the next release
Thank you so much! I got no error. I shared a sample project 👍 https://github.com/kaibadash/exposed_ignored_transaction