Search in sources :

Example 1 with Aliased

use of org.springframework.data.relational.core.sql.Aliased in project spring-data-jdbc by spring-projects.

the class SqlGeneratorUnitTests method joinForOneToOneWithoutId.

// DATAJDBC-340
@Test
void joinForOneToOneWithoutId() {
    SqlGenerator.Join join = generateJoin("child", ParentOfNoIdChild.class);
    Table joinTable = join.getJoinTable();
    assertSoftly(softly -> {
        softly.assertThat(joinTable.getName()).isEqualTo(SqlIdentifier.quoted("NO_ID_CHILD"));
        softly.assertThat(joinTable).isInstanceOf(Aliased.class);
        softly.assertThat(((Aliased) joinTable).getAlias()).isEqualTo(SqlIdentifier.quoted("child"));
        softly.assertThat(join.getJoinColumn().getTable()).isEqualTo(joinTable);
        softly.assertThat(join.getJoinColumn().getName()).isEqualTo(SqlIdentifier.quoted("PARENT_OF_NO_ID_CHILD"));
        softly.assertThat(join.getParentId().getName()).isEqualTo(SqlIdentifier.quoted("X_ID"));
        softly.assertThat(join.getParentId().getTable().getName()).isEqualTo(SqlIdentifier.quoted("PARENT_OF_NO_ID_CHILD"));
    });
}
Also used : Table(org.springframework.data.relational.core.sql.Table) Aliased(org.springframework.data.relational.core.sql.Aliased) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 Aliased (org.springframework.data.relational.core.sql.Aliased)1 Table (org.springframework.data.relational.core.sql.Table)1