java - QueryDSL to get any entities in a collection of another entity -
i'm using jpa hibernate , querydsl (v.4.0.5). have entity:
package com.test.model.entity; @entity public class article { @id private long id; @manytomany(fetch = lazy, cascade = detach) private set<tag> tags; }
how can find articles matching given set of tag
s? think should start follows:
public booleanexpression hastag(set<tag> tags){ final qarticle article = qarticle.article; return article.tags.any().eqany(ce); }
where ce
should collectionexpression
. have no idea how set this.
any solution?
did try
public booleanexpression hastag(set<tag> tags){ qarticle article = qarticle.article; return article.tags.any().in(tags); }
Comments
Post a Comment