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

darkmoon_uk

08/24/2020, 2:23 PM
How do I simply have a collection of strings in an object? (Using DAO) This basic use case doesn't seem to be catered for in the DAO guide. I can see how to do it with a full 'Entity' for each string, each with its ID and reference etc, but this is unnecessarily heavy - just a table with 'parentId, string' should be all that's necessary to implement the one-to-many relationship. I can't believe Exposed has missed this out...
t

tapac

08/24/2020, 8:37 PM
What do you plan to do with those strings? If you'd like to make sql queries on them, then you need a column. As it's one-to-many, you need two tables and two entities. Or you do not like the fact that you need to use it as:
parent.children.map { it.strCol }
?