Package org.apache.metamodel

Examples of org.apache.metamodel.AbstractDataContext


  }

  // test-case to recreate the problems reported at
  // http://eobjects.org/trac/discussion/7/134
  public void testLeftJoinQueries() throws Exception {
    DataContext dc = new AbstractDataContext() {

      @Override
      public DataSet executeQuery(Query query) throws MetaModelException {
        throw new UnsupportedOperationException();
      }

      @Override
      protected String[] getSchemaNamesInternal() {
        throw new UnsupportedOperationException();
      }

      @Override
      protected String getDefaultSchemaName() {
        throw new UnsupportedOperationException();
      }

      @Override
      protected Schema getSchemaByNameInternal(String name) {
        throw new UnsupportedOperationException();
      }
    };
    Table tableAB = new MutableTable("tableAB");
    Table tableC = new MutableTable("tableC");

    Column colA = new MutableColumn("colA", null, tableAB, 0, true);
    Column colB = new MutableColumn("colB", null, tableAB, 1, true);
    Column colC = new MutableColumn("colC", null, tableC, 0, true);

    Query q = dc.query().from(tableAB).leftJoin(tableC).on(colB, colC)
        .select(colA).as("a").select(colB).as("b").select(colC).as("c")
        .toQuery();

    assertEquals(
        "SELECT tableAB.colA AS a, tableAB.colB AS b, tableC.colC AS c FROM tableAB LEFT JOIN tableC ON tableAB.colB = tableC.colC",
View Full Code Here

TOP

Related Classes of org.apache.metamodel.AbstractDataContext

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.