use of com.querydsl.sql.domain.QSurvey in project querydsl by querydsl.
the class SerializationTest method with_tuple2.
@Test
public void with_tuple2() {
QSurvey survey2 = new QSurvey("survey2");
SQLQuery<?> q = new SQLQuery<Void>();
q.with(survey, survey.id, survey.name).as(select(survey2.id, survey2.name).from(survey2));
assertEquals("with SURVEY (ID, NAME) as (select survey2.ID, survey2.NAME\n" + "from SURVEY survey2)\n\n" + "from dual", q.toString());
}
use of com.querydsl.sql.domain.QSurvey in project querydsl by querydsl.
the class SerializationTest method delete_with_subQuery_exists.
@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"), selectOne().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" + "where SURVEY.ID = e.ID)", delete.toString());
}
use of com.querydsl.sql.domain.QSurvey in project querydsl by querydsl.
the class SerializationTest method innerJoin.
@Test
public void innerJoin() {
SQLQuery<?> query = new SQLQuery<Void>(connection, SQLTemplates.DEFAULT);
query.from(new QSurvey("s1")).innerJoin(new QSurvey("s2"));
assertEquals("from SURVEY s1\ninner join SURVEY s2", query.toString());
}
use of com.querydsl.sql.domain.QSurvey in project querydsl by querydsl.
the class SerializationTest method leftJoin.
@Test
public void leftJoin() {
SQLQuery<?> query = new SQLQuery<Void>(connection, SQLTemplates.DEFAULT);
query.from(new QSurvey("s1")).leftJoin(new QSurvey("s2"));
assertEquals("from SURVEY s1\nleft join SURVEY s2", query.toString());
}
use of com.querydsl.sql.domain.QSurvey in project querydsl by querydsl.
the class SQLSubQueryTest method complex.
@Test
public void complex() {
// related to #584795
QSurvey survey = new QSurvey("survey");
QEmployee emp1 = new QEmployee("emp1");
QEmployee emp2 = new QEmployee("emp2");
SubQueryExpression<?> subQuery = select(survey.id, emp2.firstname).from(survey).innerJoin(emp1).on(survey.id.eq(emp1.id)).innerJoin(emp2).on(emp1.superiorId.eq(emp2.superiorId), emp1.firstname.eq(emp2.firstname));
assertEquals(3, subQuery.getMetadata().getJoins().size());
}
Aggregations