https://kotlinlang.org logo
r

rapho

06/10/2019, 3:20 PM
I have a tableA with two references, how can I query this table like:
TableA.selectAll().where(TableA.ref1 = object1 and TableA.ref2= object2)
Currently i do
Copy code
ref1.tableA.filter { ref2 != object2 }
But I guess I could also do this with exposed
t

tapac

06/10/2019, 4:44 PM
TableA.select { TableA.ref1 eq object1 and (TableA.ref2 eq object2) }
https://github.com/JetBrains/Exposed/wiki/DSL#read
r

rapho

06/10/2019, 4:50 PM
I'm trying but somehow I cant use
eq
, and I dont know why.
t

tapac

06/10/2019, 4:50 PM
what is the
game
? If it's Entity then you have to write
eq game.id
r

rapho

06/10/2019, 4:51 PM
Copy code
object GameAnswers : IntIdTable() {
    val game = reference("game", Games)
    val user = reference("user", Users)
Thats the table
Aha
Interesting, didn't know! Yes with id it works
Thanks
4 Views