6
7

More than 5 years have passed since last update.

Ebean で (a or b) and (c or d or e) みたいなクエリを作る

Posted at

たくさん or を繋ぐなら junction 使えってリファレンスに書いてあるんだけど、それを更に and で繋ぎたくなったらどうするの?って話。結論、endJunction で一旦切ればいいようです。

find.where()
    .disjunction()
        .add(a)
        .add(b)
        .endJunction()
    .disjunction()
        .add(c)
        .add(d)
        .add(e)
// .findList() なりなんなり

a とか b とかは、実際にはこういうやつ。

Expr.eq("column1", somevalue) とか
Expr.lt("column2", 100) とか

参考にしたサイト

6
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
7