I'm new to Ebean's world for play framework.
I have basically two classes, User and Book.
A user have several books. Also a user may have books with same title multiple time what ever the author or edition is. What i need is to link the books with user where same title of book will come only once whatever the other proprieties of the book is. That means retrieving the book list distinct on book's title.
Here it is what I've done so far
User Class
@Entity
public class User extends Model{
@Id
public int id;
public String name;
@ManyToMany(targetEntity = Book.class,cascade=CascadeType.ALL)
public List<Book> book;
}
Book Class
@Entity
public class Book extends Model{
@Id
public int id;
@Column(unique=true)
public String name;
public String author;
public int edition;
public int user_id;
}
But the multiple books having same title are not distinctly filtered. How to put the annotation correctly here so that I can only get one row for same title of book?