I am using Play 2.0.2 with ebean.
In Info
class, I defined
@ManyToMany(fetch=FetchType.EAGER)
private Set<MemberInfo> members;
private Date createdDate = new Date();
And MemberInfo
has memberId
field.
When I do
public static Finder<Long,Info> find
= new Finder<Long,Info>(Long.class, Info.class);
find.fetch("members")
.where().filterMany("members").eq("memberId", memberId)
.order().desc("createdDate")
.findList();
It returns all Info
, without checking memberId
of members
.
What did I do wrong? Thanks.
filterMany()
doesn't filter parent results by children's expressions (both has separate 'ranges').
As descriped in its API it will find all Info
objects and filtered members
for each.
There is also very similar topic on Google Groups where author of the question gives his own workaround for this.
Examine the difference between:
find.fetch("members")
.where().filterMany("members").eq("memberId", 1L)
.findList();
and
find.fetch("members")
.where().eq("members.memberId", 1L)
.findList();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With