Skip to content

Retain filterMany expression when they are added BEFORE a select(fetchGroup) is applied #3672

@rbygrave

Description

@rbygrave

Currently, the filterMany expressions can be lost if there is a select(fetchGroup) executed AFTER the filterMany expressions were added.

  @Test
  @DisplayName("Retain filterMany expression when select fetchGroup applied after filterMany")
  void filterManyBeforeSelectFetchGroup_expect_filterManyExpressionRetained() {
    var fetchGroup = QCustomer.forFetchGroup()
      .select(name)
      .contacts.fetch(QContact.Alias.email)
      .buildFetchGroup();

    var q = new QCustomer()
      .contacts.filterMany(c -> c.firstName.startsWith("R"))
      .select(fetchGroup)
      .query();

    q.findList();
    assertThat(q.getGeneratedSql()).contains(" t0.id, t0.name, t1.id, t1.email from be_customer t0 left join be_contact t1 on t1.customer_id = t0.id where (t1.id is null or (t1.first_name like ? escape'|')) order by t0.id");
  }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions