Closed lamba92 closed 5 years ago
I guess it was easier then I thought!
class Camera(id: EntityID<Int>) : IntEntity(id) {
var snapshotUris = CameraSnapshotUri.find { CamerasSnapshotUriTable.cameraId eq id }
}
Did you try?
class Camera(id: EntityID<Int>) : IntEntity(id) {
var snapshotUris = CameraSnapshotUri.referrersOn(CamerasSnapshotUriTable.cameraId)
This case described here closer to the end (look for Now if you wanted to get all the ratings for a film
)
val snapshotUris by CameraSnapshotUrl referrersOn CamerasSnapshotUrlTable.cameraId
did just fine! Thank you!
I'd recomment to write it more explicitly int the wiki with a section titled many-to-one
@lamba92 , wiki is open for a contibution. Feel free to update that section.
Say you have 2 tables,
CameraTable
andSnapshotUriTable
. Now for eachcamera
you have manysnapshotUri
s. You could follow the example and create an intermediary table, but what if you want to store the reference insideSnapshotUriTable
with a column containing theid
of thecamera
?