QueryDSL duplicate identification variable/equality syntax error with any on Set?

人盡茶涼 提交于 2019-12-02 05:43:17

Can you use a join instead of a sub-select? This would be much more efficient as well.

You could also try EclipseLink 2.4, which may not have these issues.

QueryDSL supports joins, both innerJoin() and leftJoin(), you should use this instead.

Currently there are bugs in EclipseLink and QueryDSL that deny usage of the straight forward statements:

q.where(license.tags.any().in(withTags));
q.where(license.tags.any().in(withoutTags).not());

Instead a workaround has to be used:

Collection<Integer> withTagIds = new ArrayList<Integer>();
for (Tag tag : withTags) {
    withTagIds.add(tag.getId());
}
q.where(license.tags.any().id.in(withTagIds));

Collection<Integer> withoutTagIds = new ArrayList<Integer>();
for (Tag tag : withoutTags) {
    withoutTagIds .add(tag.getId());
}
q.where(license.tags.any().id.in(withoutTagIds ).not());
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!