Package com.mysema.query.sql.domain

Examples of com.mysema.query.sql.domain.QEmployee


    }

    @Test
    public void Delete_with_SubQuery_exists() {
        QSurvey survey1 = new QSurvey("s1");
        QEmployee employee = new QEmployee("e");
        SQLDeleteClause delete = new SQLDeleteClause(connection, SQLTemplates.DEFAULT,survey1);
        delete.where(survey1.name.eq("XXX"), new SQLSubQuery().from(employee).where(survey1.id.eq(employee.id)).exists());
        assertEquals("delete from SURVEY\n" +
                     "where SURVEY.NAME = ? and exists (select 1\n" +
                     "from EMPLOYEE e\n" +
View Full Code Here


        return new SQLSubQuery();
    }

    @Test
    public void SimpleQuery() {
        QEmployee employee2 = new QEmployee("employee2");
        SQLQuery query = query().from(employee, employee2);

        assertEquals(ImmutableSet.of(employee, employee2), extract(query.getMetadata()));
    }
View Full Code Here

        assertEquals(ImmutableSet.of(employee, employee2), extract(query.getMetadata()));
    }

    @Test
    public void Joins() {
        QEmployee employee2 = new QEmployee("employee2");
        SQLQuery query = query().from(employee)
                .innerJoin(employee2).on(employee.superiorId.eq(employee2.id));

        assertEquals(ImmutableSet.of(employee, employee2), extract(query.getMetadata()));
    }
View Full Code Here

        assertEquals(ImmutableSet.of(employee), extract(query.getMetadata()));
    }

    @Test
    public void SubQuery2() {
        QEmployee employee2 = new QEmployee("employee2");
        SQLQuery query = query().from(employee)
            .where(Expressions.list(employee.id, employee.lastname)
                .in(sq().from(employee2).list(employee2.id, employee2.lastname)));

        assertEquals(ImmutableSet.of(employee, employee2), extract(query.getMetadata()));
View Full Code Here

public class ForeignKeyTest {

    @Test
    public void On() {
        QEmployee employee = new QEmployee("employee");
        QEmployee employee2 = new QEmployee("employee2");

        ForeignKey<Employee> foreignKey = new ForeignKey<Employee>(employee, employee.superiorId, "ID");
        assertEquals("employee.superiorId = employee2.ID", foreignKey.on(employee2).toString());

        foreignKey = new ForeignKey<Employee>(employee,
View Full Code Here

        list.add(new SQLServer2005Templates()); // inner query
        list.add(new SQLServer2012Templates());
        list.add(new TeradataTemplates()); // qualify

        for (SQLTemplates templates : list) {
            QEmployee employee = QEmployee.employee;
            QueryMixin query = new QueryMixin();
            query.from(employee);
            query.orderBy(employee.firstname.asc());
            query.addProjection(employee.id);
View Full Code Here

    }

    @Test
    public void Update_with_SubQuery_exists() {
        QSurvey survey1 = new QSurvey("s1");
        QEmployee employee = new QEmployee("e");
        SQLUpdateClause update = update(survey1);
        update.set(survey1.name, "AA");
        update.where(new SQLSubQuery().from(employee).where(survey1.id.eq(employee.id)).exists());
        update.execute();
    }
View Full Code Here

    }

    @Test
    public void Update_with_SubQuery_exists_Params() {
        QSurvey survey1 = new QSurvey("s1");
        QEmployee employee = new QEmployee("e");

        Param<Integer> param = new Param<Integer>(Integer.class, "param");
        SQLSubQuery sq = sq().from(employee).where(employee.id.eq(param));
        sq.set(param, -12478923);
View Full Code Here

    }

    @Test
    public void Update_with_SubQuery_exists2() {
        QSurvey survey1 = new QSurvey("s1");
        QEmployee employee = new QEmployee("e");
        SQLUpdateClause update = update(survey1);
        update.set(survey1.name, "AA");
        update.where(new SQLSubQuery().from(employee).where(survey1.name.eq(employee.lastname)).exists());
        update.execute();
    }
View Full Code Here

    }

    @Test
    public void Update_with_SubQuery_notExists() {
        QSurvey survey1 = new QSurvey("s1");
        QEmployee employee = new QEmployee("e");
        SQLUpdateClause update = update(survey1);
        update.set(survey1.name, "AA");
        update.where(sq().from(employee).where(survey1.id.eq(employee.id)).notExists());
        update.execute();
    }
View Full Code Here

TOP

Related Classes of com.mysema.query.sql.domain.QEmployee

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.