Examples of JoinReference


Examples of org.apache.ws.jaxme.sqls.JoinReference

  public void testJoin() {
     Table table = getPrimaryKeyTable();
     Table otherTable = getForeignKeyTable(table);
     SelectStatement statement = otherTable.getSelectStatement();
     SelectTableReference tableReference = statement.getSelectTableReference();
     JoinReference joinReference = tableReference.join(table);

     TableReference refLocal = tableReference;
     TableReference refRef = tableReference.getRightJoinedTableReference();

     joinReference.getOn().addJoin((ForeignKey) otherTable.getForeignKeys().next(),
                                   refLocal, refRef);
     CombinedConstraint cc = statement.getWhere();
     BooleanConstraint bc = cc.createEQ();
     bc.addPart(tableReference.newColumnReference("MyIndex"));
     bc.addPlaceholder();
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.JoinReference

    protected SelectStatement getJoinStatement() {
        Table table = getPrimaryKeyTable();
        Table otherTable = getForeignKeyTable(table);
        SelectStatement statement = otherTable.getSelectStatement();
        SelectTableReference tableReference = statement.getSelectTableReference();
        JoinReference joinReference = tableReference.join(table);
       
        TableReference refLocal = tableReference;
        TableReference refRef = tableReference.getRightJoinedTableReference();
       
        joinReference.getOn().addJoin((ForeignKey) otherTable.getForeignKeys().next(),
                refLocal, refRef);
        CombinedConstraint cc = statement.getWhere();
        BooleanConstraint bc = cc.createEQ();
        bc.addPart(tableReference.newColumnReference("MyIndex"));
        bc.addPlaceholder();
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.JoinReference

    public void testLeftOuterJoin() {
        Table table = getPrimaryKeyTable();
        Table otherTable = getForeignKeyTable(table);
        SelectStatement statement = otherTable.getSelectStatement();
        SelectTableReference tableReference = statement.getSelectTableReference();
        JoinReference joinReference = tableReference.leftOuterJoin(table);
       
        TableReference refLocal = tableReference;
        TableReference refRef = tableReference.getRightJoinedTableReference();
       
        joinReference.getOn().addJoin((ForeignKey) otherTable.getForeignKeys().next(),
                refLocal, refRef);
        CombinedConstraint cc = statement.getWhere();
        BooleanConstraint bc = cc.createEQ();
        bc.addPart(tableReference.newColumnReference("MyIndex"));
        bc.addPlaceholder();
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.JoinReference

        f2.addPart(ref2.newColumnReference(aName2));
        f.addPart(f2);
        bc.addPart(f);
        Table t2 = st2.createView(pTableAlias);

        JoinReference result = pJoinReference.leftOuterJoin(t2);
        bc = result.getOn().createEQ();
        bc.addPart(pAkteReference.newColumnReference(dbAkte.getColumn("aId")));
        bc.addPart(result.newColumnReference(t2.getColumn(aAktenId.getName())));
        return result;
  }
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.JoinReference

     * </pre></p>
     */
    private JoinReference getFirstRowStatement(String pFilter, TableReference pAkteReference,
                         SelectTableReference pJoinReference,
                         String pTableAlias) {
        JoinReference result = pJoinReference.leftOuterJoin(dbBeteiligte);
        result.setAlias(pTableAlias);
        addAktenId(result.getOn(), pAkteReference, result);
        addEQ(result, result.getOn(), dbBeteiligte.getColumn("aFilter"), pFilter);
        BooleanConstraint bc = result.getOn().createEQ();
       
        Function f = pAkteReference.getStatement().createFunction("UPPER");
        f.addPart(result.newColumnReference(dbBeteiligte.getColumn("aName")));
        bc.addPart(f);
       
        SelectStatement minStatement = sqlFactory.newSelectStatement();
        minStatement.setTable(dbBeteiligte);
        SelectTableReference minTableRef = minStatement.getSelectTableReference();
        minTableRef.setAlias(pTableAlias + "min");
        BooleanConstraint bc2 = minStatement.getWhere().createEQ();
        bc2.addPart(result.newColumnReference(dbBeteiligte.getColumn("aAktenId")));
        bc2.addPart(minTableRef.newColumnReference(dbBeteiligte.getColumn("aAktenId")));
       
        bc2 = minStatement.getWhere().createEQ();
        bc2.addPart(minTableRef.newColumnReference(dbBeteiligte.getColumn("aFilter")));
        bc2.addPart(pFilter);
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.JoinReference

        st.setTable(dbAkte);
        SelectTableReference akte = st.getSelectTableReference();
        akte.setAlias("a");

        //aktenzeichen joinen
        JoinReference az = akte.join(dbAktenzeichen);
        az.setAlias("az");
        CombinedConstraint onClause = az.getOn();
        BooleanConstraint bc = onClause.createEQ();
        bc.addPart(akte.newColumnReference(dbAkte.getColumn("aId")));
        bc.addPart(az.newColumnReference(dbAktenzeichen.getColumn("aAktenId")));
        bc = onClause.createEQ();
        bc.addPart(az.newColumnReference(dbAktenzeichen.getColumn("aFilter")));
        bc.addPart("Hauptverfahren");

        //beteiligte joinen
        JoinReference kl, be;
        if (pUseView) {
            kl = getFirstRowStatement2("Klaeger", akte, az, "kl");
            be = getFirstRowStatement2("Beklagter", akte, kl, "be");
        } else {
            kl = getFirstRowStatement("Klaeger", akte, az, "kl");
            be = getFirstRowStatement("Beklagter", akte, kl, "be");
            st.addResultColumn(getCountStatement("anzahlKlaeger", "Klaeger", akte, "klc"));
            st.addResultColumn(getCountStatement("anzahlBeklagte", "Beklagter", akte, "bec"));
        }
        JoinReference ber = be.leftOuterJoin(dbBeteiligte);
        ber.setAlias("ber");
        addAktenId(ber.getOn(), akte, ber);
        addEQ(ber, ber.getOn(), dbBeteiligte.getColumn("aFilter"), "Beklagter");

        return st;
    }
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.JoinReference

    protected SelectStatement getJoinStatement() {
        Table table = getPrimaryKeyTable();
        Table otherTable = getForeignKeyTable(table);
        SelectStatement statement = otherTable.getSelectStatement();
        SelectTableReference tableReference = statement.getSelectTableReference();
        JoinReference joinReference = tableReference.join(table);
       
        TableReference refLocal = tableReference;
        TableReference refRef = tableReference.getRightJoinedTableReference();
       
        joinReference.getOn().addJoin((ForeignKey) otherTable.getForeignKeys().next(),
                refLocal, refRef);
        CombinedConstraint cc = statement.getWhere();
        BooleanConstraint bc = cc.createEQ();
        bc.addPart(tableReference.newColumnReference("MyIndex"));
        bc.addPlaceholder();
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.JoinReference

    public void testLeftOuterJoin() {
        Table table = getPrimaryKeyTable();
        Table otherTable = getForeignKeyTable(table);
        SelectStatement statement = otherTable.getSelectStatement();
        SelectTableReference tableReference = statement.getSelectTableReference();
        JoinReference joinReference = tableReference.leftOuterJoin(table);
       
        TableReference refLocal = tableReference;
        TableReference refRef = tableReference.getRightJoinedTableReference();
       
        joinReference.getOn().addJoin((ForeignKey) otherTable.getForeignKeys().next(),
                refLocal, refRef);
        CombinedConstraint cc = statement.getWhere();
        BooleanConstraint bc = cc.createEQ();
        bc.addPart(tableReference.newColumnReference("MyIndex"));
        bc.addPlaceholder();
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.JoinReference

        f2.addPart(ref2.newColumnReference(aName2));
        f.addPart(f2);
        bc.addPart(f);
        Table t2 = st2.createView(pTableAlias);

        JoinReference result = pJoinReference.leftOuterJoin(t2);
        bc = result.getOn().createEQ();
        bc.addPart(pAkteReference.newColumnReference(dbAkte.getColumn("aId")));
        bc.addPart(result.newColumnReference(t2.getColumn(aAktenId.getName())));
        return result;
  }
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.JoinReference

     * </pre></p>
     */
    private JoinReference getFirstRowStatement(String pFilter, TableReference pAkteReference,
                         SelectTableReference pJoinReference,
                         String pTableAlias) {
        JoinReference result = pJoinReference.leftOuterJoin(dbBeteiligte);
        result.setAlias(pTableAlias);
        addAktenId(result.getOn(), pAkteReference, result);
        addEQ(result, result.getOn(), dbBeteiligte.getColumn("aFilter"), pFilter);
        BooleanConstraint bc = result.getOn().createEQ();
       
        Function f = pAkteReference.getStatement().createFunction("UPPER");
        f.addPart(result.newColumnReference(dbBeteiligte.getColumn("aName")));
        bc.addPart(f);
       
        SelectStatement minStatement = sqlFactory.newSelectStatement();
        minStatement.setTable(dbBeteiligte);
        SelectTableReference minTableRef = minStatement.getSelectTableReference();
        minTableRef.setAlias(pTableAlias + "min");
        BooleanConstraint bc2 = minStatement.getWhere().createEQ();
        bc2.addPart(result.newColumnReference(dbBeteiligte.getColumn("aAktenId")));
        bc2.addPart(minTableRef.newColumnReference(dbBeteiligte.getColumn("aAktenId")));
       
        bc2 = minStatement.getWhere().createEQ();
        bc2.addPart(minTableRef.newColumnReference(dbBeteiligte.getColumn("aFilter")));
        bc2.addPart(pFilter);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.