假设我有这样的表格:
object Leagues : IntIdTable() {
val name = varchar("name", 50).uniqueIndex()
}
object Matches: IntIdTable() {
val game = reference("game", Games)
}
object Users: IntIdTable() {
val name = varchar("name", 50).uniqueIndex()
}
object Bets: IntIdTable() {
val match = reference("match", Matches)
val user = reference("user", Users)
}
Daos 是:
class Bet(id: EntityID<Int>) : IntEntity(id) {
companion object : IntEntityClass<Bet>(Bets)
var match by Bets.match
var user by Bets.user
}
我如何为 Bets 类编写 dao 或查询,以便我可以查询“给我玩家 X 在 Y 联赛中所做的所有赌注”。Bet.find { (user eq X) and (/* what here to get the leagues table ? */) }