Package com.mysema.query.sql.domain

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


    private final Connection connection = EasyMock.createMock(Connection.class);

    @Test
    public void InnerJoin() {
        SQLQuery query = new SQLQuery(connection,SQLTemplates.DEFAULT);
        query.from(new QSurvey("s1")).innerJoin(new QSurvey("s2"));
        assertEquals("from SURVEY s1\ninner join SURVEY s2", query.toString());
    }
View Full Code Here


    }

    @Test
    public void LeftJoin() {
        SQLQuery query = new SQLQuery(connection,SQLTemplates.DEFAULT);
        query.from(new QSurvey("s1")).leftJoin(new QSurvey("s2"));
        assertEquals("from SURVEY s1\nleft join SURVEY s2", query.toString());
    }
View Full Code Here

    }

    @Test
    public void RightJoin() {
        SQLQuery query = new SQLQuery(connection,SQLTemplates.DEFAULT);
        query.from(new QSurvey("s1")).rightJoin(new QSurvey("s2"));
        assertEquals("from SURVEY s1\nright join SURVEY s2", query.toString());
    }
View Full Code Here

    }

    @Test
    public void FullJoin() {
        SQLQuery query = new SQLQuery(connection,SQLTemplates.DEFAULT);
        query.from(new QSurvey("s1")).fullJoin(new QSurvey("s2"));
        assertEquals("from SURVEY s1\nfull join SURVEY s2", query.toString());
    }
View Full Code Here

        assertEquals("insert into SURVEY (ID, NAME)\nvalues (?, ?)", insertClause.toString());
    }

    @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" +
View Full Code Here

    }

    @Test
    public void With() {
        QSurvey survey2 = new QSurvey("survey2");
        SQLQuery q = new SQLQuery(SQLTemplates.DEFAULT);
        q.with(survey, survey.id, survey.name).as(
                new SQLSubQuery().from(survey2).list(survey2.id, survey2.name));

        assertEquals("with SURVEY (ID, NAME) as (select survey2.ID, survey2.NAME\n" +
View Full Code Here

    }

    @Test
    public void With_Tuple() {
        PathBuilder<Survey> survey = new PathBuilder<Survey>(Survey.class, "SURVEY");
        QSurvey survey2 = new QSurvey("survey2");
        SQLQuery q = new SQLQuery(SQLTemplates.DEFAULT);
        q.with(survey, survey.get(survey2.id), survey.get(survey2.name)).as(
                new SQLSubQuery().from(survey2).list(survey2.id, survey2.name));

        assertEquals("with SURVEY (ID, NAME) as (select survey2.ID, survey2.NAME\n" +
View Full Code Here

            "from dual", q.toString());
    }

    @Test
    public void With_Tuple2() {
        QSurvey survey2 = new QSurvey("survey2");
        SQLQuery q = new SQLQuery(SQLTemplates.DEFAULT);
        q.with(survey, survey.id, survey.name).as(
                new SQLSubQuery().from(survey2).list(survey2.id, survey2.name));

        assertEquals("with SURVEY (ID, NAME) as (select survey2.ID, survey2.NAME\n" +
View Full Code Here

                "from dual", q.toString());
    }

    @Test
    public void With_SingleColumn() {
        QSurvey survey2 = new QSurvey("survey2");
        SQLQuery q = new SQLQuery(SQLTemplates.DEFAULT);
        q.with(survey, new Path[]{ survey.id }).as(
                new SQLSubQuery().from(survey2).list(survey2.id));

        assertEquals("with SURVEY (ID) as (select survey2.ID\n" +
View Full Code Here

public class RelationalPathTest {

    @Test
    public void Path() throws ClassNotFoundException, IOException {
        QSurvey survey = QSurvey.survey;
        QSurvey survey2 = (QSurvey) serialize(survey);
        assertEquals(Arrays.asList(survey.all()), Arrays.asList(survey2.all()));
        assertEquals(survey.getMetadata(), survey2.getMetadata());
        assertEquals(survey.getMetadata(survey.id), survey2.getMetadata(survey.id));
    }
View Full Code Here

TOP

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

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.