Skip to content

Commit

Permalink
Adjust test such that table alias does not clash
Browse files Browse the repository at this point in the history
The .raw("contact.customer_id = customer.id") clashes as "customer.id" is
a logical path from contact
  • Loading branch information
rbygrave committed Jan 18, 2024
1 parent 2e1b52d commit 0046d98
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ public void testQuery() {
@Test
public void testOrWithExists() {
QCustomer query = Customer.find.typed()
.alias("customer")
.alias("_cust")
.or()
.name.eq("Superman")
.exists(Contact.find.typed()
.alias("contact")
.firstName.eq("Superman")
.raw("contact.customer_id = customer.id")
.raw("contact.customer_id = _cust.id")
.query()
)
.endOr()
Expand All @@ -77,9 +77,9 @@ public void testOrWithExists() {
query.findList();

assertThat(query.getGeneratedSql()).isEqualTo(
"select customer.id from be_customer customer where (" +
"customer.name = ? or exists (select 1 from be_contact contact where " +
"contact.first_name = ? and contact.customer_id = customer.id))"
"select _cust.id from be_customer _cust where (" +
"_cust.name = ? or exists (select 1 from be_contact contact where " +
"contact.first_name = ? and contact.customer_id = _cust.id))"
);
}

Expand Down

0 comments on commit 0046d98

Please sign in to comment.