我想要一个带有问题和答案地图的实体测试(一个问题允许多个答案)。这是表格(固定):
_____________
|Question |
|-----------|
|+ id |
|+ question |
|___________|
_____________
|Answer |
|-----------|
|+ id |
|+ answer |
|___________|
_____________
|wrong | -- ASSOCIATION WITH TRICKY ANSWERS
|-----------|
|+ answer |
|+ question |
|___________|
_____________
|exact | -- ASSOCIATION WITH CORRECT ANSWERS
|-----------|
|+ answer |
|+ question |
|___________|
_____________
|Test |
|-----------|
|+ id |
|___________|
_____________
|Selection |
|-----------|
|+ id |
|+ test |
|+ question |
|___________|
_____________
|reply |
|-----------|
|+ selection|
|+ answer |
|___________|
在我的实体测试中,我想放置那些行,但代码不能编译......
@OneToMany
@JoinTable(
name = "selection",
joinColumns = @JoinColumn(name = "fk_test"),
inverseJoinColumns = @JoinTable(
name = "reply",
joinColumns = @JoinColumn(name = "fk_selection"),
inverseJoinColumns = @JoinColumn(name = "fk_answer")))
private Map<Question, List<Answer>> selections;
我不喜欢有实体选择,它非常“丑陋”#34;我在网上找不到解决方案......