#2873 - Query Beans: Support more TQProperty's as target value for inRangeWith()

This commit is contained in:
Rob Bygrave
2022-11-02 17:35:00 +13:00
parent 600aa10453
commit dd0ed8ea76
7 changed files with 88 additions and 0 deletions
@@ -665,6 +665,22 @@ public class QCustomerTest {
.findList();
}
@Test
void query_inRangeWithOtherProperties() {
var c = QCustomer.alias();
Query<Customer> query = new QCustomer()
.select(c.id)
.name.inRangeWith(c.contacts.firstName, c.contacts.lastName)
.query();
// select distinct t0.id from be_customer t0
// left join be_contact t1 on t1.customer_id = t0.id
// where t1.first_name <= t0.name and (t0.name < t1.last_name or t1.last_name is null)
query.findList();
assertThat(query.getGeneratedSql()).contains(" where t1.first_name <= t0.name and (t0.name < t1.last_name or t1.last_name is null)");
}
@Test
public void query_exists() {