https://kotlinlang.org logo
j

jkbbwr

09/19/2017, 4:24 PM
Okay so got past that, it was hiding an uninitialized field. New error is now
Copy code
Error:(36, 11) Kotlin: Type parameter bound for T in operator infix fun <T : Number> get(column: Column<T>): T
 is not satisfied: inferred type UUID is not a subtype of Number
for code
Copy code
object City : Table("city") {
    val id = uuid("id").clientDefault { UUID.randomUUID() }.primaryKey()
    val name = text("name")
}

fun main(args: Array<String>) {
    Database.connect("jdbc:sqlite:test.db", driver = "org.sqlite.JDBC", manager = {
        ThreadLocalTransactionManager(it, TRANSACTION_READ_UNCOMMITTED)
    })

    transaction {
        logger.addLogger(StdOutSqlLogger)
        create(User, City)

        val x = City.insert {
            it[name] = "london"
        } get (City.id)
        println(x)

    }
}