mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1296 - where().exampleLike(bean) ... with 'empty bean' produces invalid SQL
This commit is contained in:
@@ -91,6 +91,25 @@ public class DefaultExampleExpressionTest extends BaseExpressionTest {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyExampleBean() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
Customer customer = new Customer();
|
||||
|
||||
Query<Customer> query = server().find(Customer.class)
|
||||
.where()
|
||||
.eq("status", Customer.Status.NEW)
|
||||
.exampleLike(customer)
|
||||
.startsWith("name", "Rob")
|
||||
.query();
|
||||
|
||||
query.findList();
|
||||
|
||||
assertThat(sqlOf(query)).contains("and 1=1 and t0.name like");
|
||||
}
|
||||
|
||||
private <T> OrmQueryRequest<T> create(SpiQuery<T> query) {
|
||||
return new OrmQueryRequest<>(null, null, query, null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user