刚才白写了。
Book{id,name,isbn}
Author{id,name}
BookAuthor{id,bookid,authorid,type} //type: 0, 作者; 1,译者
@ManyMany已经不够用了,有没有@ManyManyMany呢?
11 回复
哈哈
2个类book,author。
在book中创建
@ManyMany(from = "bookid", relation = "BookAuthor", target = Author.class, to = "authorid")
List authors //此种情况,BookAuthor->type=0
以及
@ManyMany(from = "bookid", relation = "BookAuthor", target = Author.class, to = "authorid")
List translators //此种情况,BookAuthor->type=0
不能在ManyMany注解中指明type。
所以authors和translators是一样的了。
@ManyMany(from = "bookid", relation = "BookAuthor", target = Author.class, to = "authorid")
private List<Author> authors;//此种情况,BookAuthor->type=0
@ManyMany(from = "bookid", relation = "BookAuthor", target = Author.class, to = "authorid")
private List<Author> translators;//此种情况,BookAuthor->type=0 这里应改为 type=1
@xiciliu 暂时提供不了,报个issue吧
@xiciliu 我觉得还是业务设计的问题,正常的场景不会用到这么多关联
添加回复
请先登陆