I've run into a compiler warning from the `eq` ope...
# exposed
g
I've run into a compiler warning from the
eq
operator when comparing two columns one of Column<String> with Column<EntityID<String>>. I've got a way around this, but I'm wondering if there is a cleaner way. More detail in 🧵
We have TableA : Table() that references TableB : IdTable<String>. TableA.window (String) references TableB.id (EntityID<String>).
The compiler warning the eq operator gives has to do with trying to compare String with EntityID<String>: Type argument for a type parameter S2 can't be inferred because it has incompatible upper bounds: EntityID<String>, String (multiple incompatible classes). This will become an error in Kotlin 2.0.
Used in a context like this where we're trying to select on those two values matching: TableA.select { TableA.window eq TableB.id }
One option would be to make TableA.window be an EntityID<String> and make TableA : IdTable<String> which is sort of ugly, because you end up with something like this:
Copy code
object TableA : IdTable<String>("table_a") {
  val window = varchar("window_id", 255).entityId().references(TableB.id)
  override val id = window
}
Which feels sort of dirty.
But maybe it's fine?
Anyway... If anyone has any thoughts or suggestions or questions, I would really appreciate any help.
I feel like one cannot simply go around making things EntityIDs.
Also I've already found another instance of this where making Column<T> become Column<EntityID<T>> isn't an easy or obvious option--as the table already has an id column.
I don't know what the right thing to do is, but this is definitely not it.
c
Hi @Greg Poirier A fix for this issue (EXPOSED-114) was released in version 0.47.0. If that is the version that you're using and you're still seeing this compiler warning, please open a ticket on YouTrack with details about your tables and
eq
usage, so we can investigate further.
g
Ha! We recently updated to 0.47. I will take a look.
Kismet.
By recently, I mean the EU contingent of my team did it while I was asleep. 🙂
Thank you. I'll take a look at it today.
👍 1