Hi :slightly_smiling_face: I am having a difficult...
# exposed
y
Hi 🙂 I am having a difficulty with the join mechanism: apparently if you hold a reference to a table and you join them
Copy code
object UserQuestionTable : LongIdTable("user_question") {
    val uid = reference("uid", UserTable, onDelete = ReferenceOption.CASCADE)
    val oid = optReference("oid", OtherTable)
    val allow = bool("allow").default(true)
}
but you have a complex join that is not just the reference ids equal
Copy code
UserQuestionTable.join(OtherTable, JoinType.LEFT, additionalConstraint = {
(OtherTable.id inList otherIds) and (
                (OtherTable.id eq UserQuestionTable.oid) or (
                    UserQuestionTable.oid.isNull() and (UserQuestionTable.allow eq true)
                    )
                )
        })
but the output query is added a
user_question.oid = other.id
and then the rest of the additional constraint query what can I do to remove this addition?
👍 1
t
Please try to specify that you don't need to use implicit reference by using extended join version:
Copy code
UserQuestionTable.join(OtherTable, JoinType.LEFT, onColumn = null, otherColumn = null, additionalConstraint = { /* your condition */ })
y
tried that, it still adds a condition
user_question.oid = other.id AND (my condition)
as a hack solution I removed the reference in the exposed table (code only). using just a long type for now
should I open an issue in github?
t
Oh, I found a bug. Will fix it now.
y
YES, awesome, thanks