1

I have two classes :

public class Tag {
@Id
public int id;

@ManyToMany(cascade=CascadeType.ALL)
public static List<Article> articles;

public static Finder<Long, Tag> find = new Finder<Long, Tag>(Long.class, Tag.class);
}


public class Article {  
@Id
public int id;

@Constraints.Required
public String title;

@ManyToMany(cascade=CascadeType.ALL)
public static List<Tag> tags;

public static Finder<Long, Article> find = new Finder<Long, Article>(Long.class,     Article.class);

I need function that gain article as parameter and give back list of tags, related to this article

user1691070
  • 363
  • 2
  • 3
  • 9

1 Answers1

0

Try this:

public List<Tag> findTagsByArticle(Article article) {
    return find.fetch("articles").where().eq("articles.id", article.id).findList();     
}

Check similar question with answer

filterMany() is described in its API

Community
  • 1
  • 1
Levente Holló
  • 714
  • 6
  • 13