https://kotlinlang.org logo
#exposed
Title
# exposed
m

mkporwit

04/02/2018, 7:12 PM
Rather than using the implicit Orgs id, I want to reference on the Orgs (and Users) uid, which is a unique string. What’s the proper syntax for defining OrgMembership in that case? IntelliJ complains that
val org by Org referencedOn OrgMemberships.orgId
has a type mismatch, where it expects a
Column<EntityId<Int>>
but gets a
Column<EntityId<String>>
. How do I tell OrgMembership to use that string?
t

tapac

04/03/2018, 10:23 AM
Why then you use IntIdTable, instead of IdTable<String>() ? Please look on declaration of UUIDTable class.
m

mkporwit

04/03/2018, 11:58 AM
But if I use that, then I lose the implicit int id as PK on the Orgs table, right? What I was hoping to do was to use a column that is unique but is not a PK as an FK reference, which is something MySQL supports…
t

tapac

04/03/2018, 4:47 PM
It's not so easy to implement with some "quick-fix", because it requires to rework current references implementation. I created issue https://github.com/JetBrains/Exposed/issues/282 to support it in future
m

mkporwit

04/03/2018, 5:38 PM
Gotcha. Figured it might still be a missing feature. Didn’t think to look through the open issues.
So, I can either change Orgs and Users to be String entity IDs, and then use the UUID, or I can leave them as IntEntityIds and do the join on the int IDs.
Thanks for clarifying.