Package org.apache.metamodel.schema

Examples of org.apache.metamodel.schema.Relationship


        assertTrue(dataSet.next());
        assertEquals("Row[values=[project_contributor, VIEW, 3, null]]", dataSet.getRow().toString());
        assertFalse(dataSet.next());
        dataSet.close();

        Relationship relationship = tablesTable.getRelationships(columnsTable)[0];
        FromItem joinFromItem = new FromItem(JoinType.INNER, relationship);
        Query q = new Query().select(tablesTable.getColumnByName("name")).select(columnsTable.getColumnByName("name"))
                .select(columnsTable.getBooleanColumns()).from(joinFromItem);

        assertEquals("SELECT tables.name, columns.name, columns.nullable, columns.indexed "
View Full Code Here


  public void testExecuteQuery() throws Exception {
    Schema schema = _dataContext.getSchemaByName("HR");
    Table employeeTable = schema.getTableByName("EMPLOYEES");
    Table departmentsTable = schema.getTableByName("DEPARTMENTS");
    Relationship relationship = employeeTable
        .getRelationships(departmentsTable)[0];
    assertEquals(
        "Relationship[primaryTable=EMPLOYEES,primaryColumns={EMPLOYEE_ID},foreignTable=DEPARTMENTS,foreignColumns={MANAGER_ID}]",
        relationship.toString());

    Query q = new Query().from(new FromItem(JoinType.INNER, relationship))
        .select(employeeTable.getColumnByName("EMAIL"),
            departmentsTable.getColumnByName("DEPARTMENT_NAME"));
    q.getSelectClause().getItem(0).setAlias("e-mail");
View Full Code Here

TOP

Related Classes of org.apache.metamodel.schema.Relationship

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.