What exactly is the use case for suspendedTransact...
# exposed
a
What exactly is the use case for suspendedTransaction vs. just always using newSuspendedTransaction? From the wiki:
Copy code
runBlocking {
    transaction {    
        SchemaUtils.create(FooTable) // Table will be created on a current thread
    
        newSuspendedTransaction(Dispatchers.Default) {
            FooTable.insert { it[id] = 1 } // This insert will be executed in one of Default dispatcher threads
    
            suspendedTransaction {
                val id = FooTable.select { FooTable.id eq 1 }.single()()[FooTable.id] // This select also will be executed on some thread from Default dispatcher using the same transaction
            }
        }
    
        val result = newSuspendedTransaction(<http://Dispatchers.IO|Dispatchers.IO>) {
            FooTable.select { FooTable.id eq 1 }.single()[H2Tests.Testing.id] // This select will be executed on some thread from IO dispatcher using the same transaction
        }
    }
}
I believe the wiki example has an error in the comments. Shouldn't it say "using a new nested transaction" in the last comment?
👀 1