Package com.mysema.query.sql.dml

Examples of com.mysema.query.sql.dml.SQLUpdateClause.execute()


        insert(survey).values(3, "B","C").execute();

        SQLUpdateClause update = update(survey);
        update.set(survey.name, "AA").where(survey.name.eq("A")).addBatch();
        update.set(survey.name, "BB").where(survey.name.eq("B")).addBatch();
        assertEquals(2, update.execute());
    }

    @Test
    public void Batch_Templates() throws SQLException{
        insert(survey).values(2, "A","B").execute();
View Full Code Here


        insert(survey).values(3, "B","C").execute();

        SQLUpdateClause update = update(survey);
        update.set(survey.name, "AA").where(survey.name.eq(Expressions.stringTemplate("'A'"))).addBatch();
        update.set(survey.name, "BB").where(survey.name.eq(Expressions.stringTemplate("'B'"))).addBatch();
        assertEquals(2, update.execute());
    }

    @Test
    public void Update_with_SubQuery_exists() {
        QSurvey survey1 = new QSurvey("s1");
View Full Code Here

        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();
    }

    @Test
    public void Update_with_SubQuery_exists_Params() {
        QSurvey survey1 = new QSurvey("s1");
View Full Code Here

        sq.set(param, -12478923);

        SQLUpdateClause update = update(survey1);
        update.set(survey1.name, "AA");
        update.where(sq.exists());
        update.execute();
    }

    @Test
    public void Update_with_SubQuery_exists2() {
        QSurvey survey1 = new QSurvey("s1");
View Full Code Here

        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();
    }

    @Test
    public void Update_with_SubQuery_notExists() {
        QSurvey survey1 = new QSurvey("s1");
View Full Code Here

        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();
    }

    @Test
    public void Update_With_TempateExpression_In_Batch() {
        update(survey)
View Full Code Here

        // update
        SQLUpdateClause update = new SQLUpdateClause(connection, configuration, person);
        update.set(person.gender, Gender.FEMALE);
        update.set(person.firstname, "Jane");
        update.where(person.id.eq(10));
        update.execute();

        // query
        query = new SQLQuery(connection, configuration);
        assertEquals(Gender.FEMALE, query.from(person).where(person.id.eq(10)).uniqueResult(person.gender));
    }
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.