سؤال

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