Philipp Mayer
08/18/2020, 4:02 PMobject Sensors : IntIdTable() {
val roomId = reference("id", Rooms.id).nullable()
val name = text("name")
}
And now I just want to select all rows and map them to my domain Object:
class Sensor(
val id: Int?,
val roomId: Int?,
val name: String
)
Sensors.selectAll().map {
Sensor(it[id], it[roomId], it[name])
}
However, if I do it as shown, I get an alert saying that it[id]
is of type string (while I expect an int).
Ist htere a better way? Why is it like that, even though my table definition is different?
Thanks in advance!tapac
08/18/2020, 4:26 PMcolumnName
parameter or rename reference("id", Rooms.id)
into reference("roomId", Rooms.id)
.Philipp Mayer
08/18/2020, 4:35 PM