Skip to content

Criteria APIを使用した3列以上のin句作成 #968

Closed Answered by nakamura-to
ironclad-15256304 asked this question in Q&A
Discussion options

You must be logged in to vote

残念ながら3列に対するIN句はサポートしていません。
代替手段としては、ANDやORを組み合わせて表現が可能です。

Employee_ e = new Employee_();

Tuple3<Integer, Integer, String> t1 = new Tuple3<>(1, 10, "a");
Tuple3<Integer, Integer, String> t2 = new Tuple3<>(2, 20, "b");
List<Tuple3<Integer, Integer, String>> list = Arrays.asList(t1, t2);

List<Employee> result =
        entityql
                .from(e)
                .where(c -> {
                    for (Tuple3<Integer, Integer, String> t : list) {
                        c.and(() -> {
                            c.or(() -> c.eq(e.employeeId, t.getItem1()));
                            c.or(() -> c.eq(e.employeeNo, t.getItem2()));
                            c.or(() -> c.eq(e.employeeName, 

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@ironclad-15256304
Comment options

@nakamura-to
Comment options

@ironclad-15256304
Comment options

@nakamura-to
Comment options

@ironclad-15256304
Comment options

Answer selected by ironclad-15256304
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants