Hi, I am looking into kotlin and ktor and try to w...
# ktor
s
Hi, I am looking into kotlin and ktor and try to work on the RealWorld github issue, for now only for me, if I get it working, I might make it public. Anyway, for database stuff I took the kweet sample as prototype, specifically the: DAOFacadeDatabase class https://github.com/Kotlin/ktor/blob/master/ktor-samples/kweet/src/kweet/dao/DAOFacadeDatabase.kt The default db is the h2 in memory and if I write a simple unit test like this:
Copy code
val daoFacadeDatabase = DAOFacadeDatabase()
daoFacadeDatabase.init()
daoFacadeDatabase.createUser("<mailto:foo@bar.de|foo@bar.de>", "foobar", "some-hash", null, null, null)
it fails with an exception that the users table does not exist:
Copy code
org.h2.jdbc.JdbcSQLException: Tabelle "USERS" nicht gefunden
Table "USERS" not found; SQL statement:
I understand where its coming from, after the transaction is done, it seems like the in memory h2 instance is just deleted again and a new one is created for the inserUser function call. I guess the better approach would be to pass in a beforehand generated reference to a in memory h2 instance?