If this is a valid way to query the db, why does i...
# getting-started
m
If this is a valid way to query the db, why does it not work for me?
Copy code
val user = db.from(Users).select(Users.columns).where { Users.email eq data.email }
        .map { row -> Users.createEntity(row) }
        .firstOrNull()
"user" returns null. (Ps: This is Ktorm)
Users.createEntity(row) is the only weird stuff there but I'm told it's to create an instance of the db object.
Ok, from what I understand, the table entry isn't created here?
Copy code
db.useTransaction {
    db.insert(Users) {
        set(it.email, data.email)
        set(it.firstName, data.firstName)
        set(it.lastName, data.lastName)
        set(it.isActive, false)
        set(it.password, hashedPwd)
        set(it.created, LocalDateTime.now())
        set(it.modified, LocalDateTime.now())
    }
}
Is there some other way to persist changes?
k
https://github.com/kotlin-orm/ktorm and then if needed, file a bug in their tracker
m
I'm going through their docs
And I can't find anything different fromm what I've done
My guess is that it's not a bug? Maybe there's something I'm doing wrong. The insertion DSL only works during initial table creation in Application.configureDatabase() extension function. But when I use it elsewhere in the app, it doesn't work.
I've moved to Exposed which works well.