use of com.querydsl.sql.domain.QEmployee in project querydsl by querydsl.
the class UpdateBase method update_with_subQuery_exists2.
@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(selectOne().from(employee).where(survey1.name.eq(employee.lastname)).exists());
assertEquals(0, update.execute());
}
use of com.querydsl.sql.domain.QEmployee in project querydsl by querydsl.
the class UpdateBase method update_with_subQuery_exists_Params.
@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");
SQLQuery<?> sq = query().from(employee).where(employee.id.eq(param));
sq.set(param, -12478923);
SQLUpdateClause update = update(survey1);
update.set(survey1.name, "AA");
update.where(sq.exists());
assertEquals(0, update.execute());
}
use of com.querydsl.sql.domain.QEmployee in project querydsl by querydsl.
the class UpdateBase method update_with_subQuery_exists.
@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(selectOne().from(employee).where(survey1.id.eq(employee.id)).exists());
assertEquals(1, update.execute());
}
use of com.querydsl.sql.domain.QEmployee in project querydsl by querydsl.
the class UpdateBase method update_with_subQuery_notExists.
@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(query().from(employee).where(survey1.id.eq(employee.id)).notExists());
assertEquals(0, update.execute());
}
use of com.querydsl.sql.domain.QEmployee in project querydsl by querydsl.
the class PaginationTest method test.
@Test
public void test() {
List<SQLTemplates> list = Lists.newArrayList();
list.add(new CUBRIDTemplates());
list.add(new DerbyTemplates());
list.add(new H2Templates());
list.add(new HSQLDBTemplates());
list.add(new MySQLTemplates());
// inner query
list.add(new OracleTemplates());
list.add(new PostgreSQLTemplates());
list.add(new SQLiteTemplates());
list.add(new SQLServerTemplates());
// inner query
list.add(new SQLServer2005Templates());
list.add(new SQLServer2012Templates());
// qualify
list.add(new TeradataTemplates());
for (SQLTemplates templates : list) {
QEmployee employee = QEmployee.employee;
QueryMixin<?> query = new QueryMixin<Void>();
query.from(employee);
query.orderBy(employee.firstname.asc());
query.setProjection(employee.id);
System.out.println(templates.getClass().getSimpleName());
System.out.println();
// limit
query.restrict(QueryModifiers.limit(10L));
System.out.println("* limit");
System.out.println(serialize(query.getMetadata(), templates));
System.out.println();
if (!templates.getClass().equals(SQLServerTemplates.class)) {
// offset
query.restrict(QueryModifiers.offset(10L));
System.out.println("* offset");
System.out.println(serialize(query.getMetadata(), templates));
System.out.println();
// limit and offset
query.restrict(new QueryModifiers(10L, 10L));
System.out.println("* limit and offset");
System.out.println(serialize(query.getMetadata(), templates));
System.out.println();
}
}
}
Aggregations