Ok, I see your arguments.
Quote:
1. What if the possible values themselves contains a comma?
- Then use white space, or any other user defined value
Quote:
2. How do you find all Cars that are available in red color with a query?
- Perhaps the major problem. For one, it could be not a very common query. A "like" will do just fine ("like" is slower than equals)
Quote:
3. If the values are numbers you may want to do calculations on them. Eg. the sum or average.
- Your aplication can do that for you. I'm not saying you should always use this approach, just that it would be nice to have the option.
Quote:
Another problem would be the size. Collections get big fairly easy and there is no way to determine how big the field needs to be.
- It could be a user defined size, although I am talking about a really small fixed set of values (1 to 3 strings of size 5 to 12 each)
Quote:
If you still want this, you can probably do this by implementing a custom UserType.
Sort of overkill to have just the string representation of a list ([one,two,three]) stored, but that would be the right way to do it (I could do some hacks in my code to trick hibernate, but that would be ugly)
It seems to me that it just isn't that common, although I do kind of use a lot of this. I just don't like to see my database filled with lots of tables that aren't entities. I do browse my database a lot, and it is much more user readable to see a csv list.
Jut as an example, Wordpress use this "comma (or other character) separated list" of values I'm talking about.