0

谁能帮我在play 2.0中使用scala使用标志位?

我在每个字节上有 7 个选项复选框(0 - 注释
1 - 测试注释
2 - facebook
3 - 电话
4 - 谷歌
5 - 跳过
6 - 奖金小
7 - 奖金大

我想用列名选项(整数)存储数据库表。

我已经经历了这个 ,但我仍然不清楚我该怎么做。提前感谢您的建议

4

1 回答 1

0

Unless you are going to have huge number of records, I would avoid to do it that way. Your approach limits your options by storage (what happens if/when you need to add new set of options...). Verifing your data manually will be more painful.
Simpler way would be have either one column for each option or if starts not to be feasible (option2) have lookup table with all options one line has.
In any case, how you store data should be independent and separated of how you use play. To enter or edit data would be variation of contacts demo application...

于 2013-02-03T13:55:41.440 回答