Package com.mysema.query.sql.dml

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


    @Test
    public void Update_Where() {
        SQLUpdateClause updateClause = new SQLUpdateClause(connection,SQLTemplates.DEFAULT,survey);
        updateClause.set(survey.id, 1);
        updateClause.set(survey.name, (String)null);
        updateClause.where(survey.name.eq("XXX"));
        assertEquals("update SURVEY\nset ID = ?, NAME = ?\nwhere SURVEY.NAME = ?", updateClause.toString());
    }

    @Test
    public void Insert() {
View Full Code Here


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

    @Test
    public void Update_with_SubQuery_exists_Params() {
View Full Code Here

        SQLSubQuery sq = sq().from(employee).where(employee.id.eq(param));
        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() {
View Full Code Here

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

    @Test
    public void Update_with_SubQuery_notExists() {
View Full Code Here

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

    @Test
    public void Update_With_TempateExpression_In_Batch() {
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.