문제

Ok, so I want to implement tags in my play 2.0 app,

Basically what I am thinking to do right now, is to use 3 tables, Questions, Tags and Question_Tags.

Should I just use different model objects for each?

Or is there some way I can set it up so that I only use Items, and Tags models, and the TagItems gets generated automatically by play?

For example, could I instead to something along the lines of:

 @Id
public String tag;
public ArrayList<Question> questions;

and let ebean handle the mapping? seems like this would be a better abstraction...

I am using Play 2.0, EBean with a MySql database, jdbc driver.

도움이 되었습니까?

해결책

Ebeans uses JPA annotations, so you can use a standard JPA @ManyToMany annotation between Questions and Tags and Ebeans will manage the tables required behind the scenes.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top