I have the following models:
@Entity @Table(name = "post") public class Post extends Model { @Id @GeneratedValue public Long id; @Column(name = "url", nullable = false, length = 255) public String url; @Column(name = "content") public String content; @OneToMany(cascade = CascadeType.ALL, mappedBy = "post") public List comments; [...]and
@Entity
@Table(name = "comment")
public class Comment extends Model {
@Id
@GeneratedValue
public Long id;
@Column(name = "content", nullable = false, length = 255)
public String content;
@Column(name = "isDelete")
public boolean isDelete = false;
@ManyToOne(cascade = CascadeType.ALL)
public Post post;
Then I try to do a search like:
Post post = find.select("*").fetch("comments").where().eq("id", postId).eq("comments.isDelete", true).findUnique();
But That's not working SQL query like :
return Post SELECT * FROM POST p INNER JOIN COMMENT c ON POST.ID=COMMENT.ID WHERE p.id = ? AND c.isDelete = false;How do i can use Ebean ? Please help me.