Playframework Java Play-如何查询OneToMany Ebean

Playframework Java Play-如何查询OneToMany Ebean,playframework,one-to-many,ebean,Playframework,One To Many,Ebean,我有以下型号: 然后我尝试进行如下搜索: public static Find<Long,Post> find = new Find<Long,Post>(){}; 但这不起作用 SQL查询,如: 回程站 从POST p内部连接注释c中选择* ON POST.ID=COMMENT.ID 其中p.id=? c.isDelete=false; 我如何使用Ebian?请帮助我。将此添加到您的博士后课程: public static Find<Long,Comment

我有以下型号:

然后我尝试进行如下搜索:

public static Find<Long,Post> find = new Find<Long,Post>(){};
但这不起作用 SQL查询,如:

回程站 从POST p内部连接注释c中选择* ON POST.ID=COMMENT.ID 其中p.id=? c.isDelete=false;
我如何使用Ebian?请帮助我。

将此添加到您的博士后课程:

public static Find<Long,Comment> find = new Find<Long,Comment>(){};
现在,您可以访问如下注释:

Post post = Post.find.fetch("comment").where().eq("id", postId).eq("comment.isDelete", true).findUnique();
List<Comment> comments = post.comments;
或:

List comments=post.comments;

你明白了

谢谢你的回答,但在我的问题中,
eq(“comments.isDelete”,true)
这对ALEX不起作用。但是在Java代码中,
@OneToMany(cascade=CascadeType.ALL,mappedBy=“post”)公共列表注释
So
fetch(“comment”)
不起作用。但是我试着写
Post-Post=find.fetch(“comments”).where().eq(“id”,posted).eq(“t1.isDelete”,false).findUnique()可以,但不好。因为我是日本人,所以英语很差。所以sorry@RuaTahi别担心,我理解你的意思,你可以从另一个角度尝试(评论),比如:List comments=Comment.find.where().eq(“postId”,postId.eq(“isDeleted”,false).findList();
@OneToMany(cascade = CascadeType.ALL, mappedBy = "post")
    public List<Comment> comments;
Post post = Post.find.fetch("comment").where().eq("id", postId).eq("comment.isDelete", true).findUnique();
post.comments
List<Comment> comments = post.comments;