mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1645 - ENH: Add expression rawOrEmpty() ... as a convenience for conditionally added a raw expression
This commit is contained in:
@@ -57,5 +57,11 @@ public class TestSqlRowUUID extends BaseTestCase {
|
||||
.findList();
|
||||
|
||||
assertThat(result).hasSize(1);
|
||||
|
||||
List<TUuidEntity> list = Ebean.find(TUuidEntity.class)
|
||||
.where().rawOrEmpty("id = any(?::uuid[])", ids)
|
||||
.findList();
|
||||
|
||||
assertThat(list).hasSize(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,10 +72,12 @@ public class TestWhereRawClause extends BaseTestCase {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
List<String> vals = asList("Rob", "Fiona", "Jack");
|
||||
|
||||
Query<Customer> query = Ebean.find(Customer.class)
|
||||
.select("name")
|
||||
.where()
|
||||
.rawOrEmpty("id in (select c.id from o_customer c where c.name in (?1))", asList("Rob", "Fiona", "Jack"))
|
||||
.rawOrEmpty("id in (select c.id from o_customer c where c.name in (?1))", vals)
|
||||
.query();
|
||||
|
||||
List<Customer> list = query.findList();
|
||||
|
||||
Reference in New Issue
Block a user