Sqlite in-memory DB transactions seem broken. Am I...
# exposed
Sqlite in-memory DB transactions seem broken. Am I doing this right? In a transaction I create a table. In another transaction, I insert a row but get an error that the table doesn’t exist. Looks like the DB disappears between transactions, which is not correct behavior.
Copy code
import org.jetbrains.exposed.dao.EntityID
import org.jetbrains.exposed.dao.UUIDEntity
import org.jetbrains.exposed.dao.UUIDEntityClass
import org.jetbrains.exposed.dao.UUIDTable
import org.jetbrains.exposed.sql.Database
import org.jetbrains.exposed.sql.SchemaUtils
import org.jetbrains.exposed.sql.Table
import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.sql.transactions.TransactionManager
import org.jetbrains.exposed.sql.transactions.transaction
import java.sql.Connection
import java.util.*

object Foo: UUIDTable(name="foo") {
    val data = text("data")
class Entity(id: EntityID<UUID>): UUIDEntity(id) {
    companion object : UUIDEntityClass<Entity>(Foo)
    var data by Foo.data

Database.connect("jdbc:sqlite::memory:", "org.sqlite.JDBC")
TransactionManager.manager.defaultIsolationLevel = Connection.TRANSACTION_SERIALIZABLE

transaction {

transaction {
    Foo.insert {
        it[data] = UUID.randomUUID().toString()
yields the following error:
Copy code
Exception in thread "main" org.jetbrains.exposed.exceptions.ExposedSQLException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (no such table: foo)
SQL: [INSERT INTO foo ("data", id) VALUES (?, ?)]