Search in sources :

Example 1 with InlineQuery

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

the class JoinVisitorTestsUnitTest method renderJoins.

static List<Fixture> renderJoins() {
    Column colOne = Column.create("colOne", Table.create("tabOne"));
    Table tabTwo = Table.create("tabTwo");
    Column colTwo = Column.create("colTwo", tabTwo);
    Column renamed = colOne.as("renamed");
    Select select = Select.builder().select(renamed).from(colOne.getTable()).build();
    InlineQuery inlineQuery = InlineQuery.create(select, "inline");
    return Arrays.asList(fixture("simple join", new TestJoin(Join.JoinType.JOIN, tabTwo, colOne.isEqualTo(colTwo)), "JOIN tabTwo ON tabOne.colOne = tabTwo.colTwo"), fixture("inlineQuery", new TestJoin(Join.JoinType.JOIN, inlineQuery, colTwo.isEqualTo(inlineQuery.column("renamed"))), "JOIN (SELECT tabOne.colOne AS renamed FROM tabOne) inline ON tabTwo.colTwo = inline.renamed"));
}
Also used : Table(org.springframework.data.relational.core.sql.Table) Column(org.springframework.data.relational.core.sql.Column) TestJoin(org.springframework.data.relational.core.sql.TestJoin) Select(org.springframework.data.relational.core.sql.Select) InlineQuery(org.springframework.data.relational.core.sql.InlineQuery)

Aggregations

Column (org.springframework.data.relational.core.sql.Column)1 InlineQuery (org.springframework.data.relational.core.sql.InlineQuery)1 Select (org.springframework.data.relational.core.sql.Select)1 Table (org.springframework.data.relational.core.sql.Table)1 TestJoin (org.springframework.data.relational.core.sql.TestJoin)1