use of com.querydsl.jpa.domain.QCat in project querydsl by querydsl.
the class JPAQueryMixinTest method orderBy_where.
@Test
public void orderBy_where() {
QCat cat = QCat.cat;
mixin.from(cat);
mixin.where(cat.mate.name.isNotNull());
mixin.orderBy(cat.mate.name.asc());
QueryMetadata md = mixin.getMetadata();
assertEquals(Arrays.asList(new JoinExpression(JoinType.DEFAULT, cat)), md.getJoins());
assertEquals(Arrays.asList(cat.mate.name.asc()), md.getOrderBy());
}
use of com.querydsl.jpa.domain.QCat in project querydsl by querydsl.
the class JPAQueryMixinTest method orderBy_any.
@Test
public void orderBy_any() {
QCat cat = QCat.cat;
QCat catKittens = new QCat("cat_kittens");
mixin.from(cat);
mixin.orderBy(cat.kittens.any().name.asc());
QueryMetadata md = mixin.getMetadata();
assertEquals(Arrays.asList(new JoinExpression(JoinType.DEFAULT, cat), new JoinExpression(JoinType.LEFTJOIN, cat.kittens.as(catKittens))), md.getJoins());
assertEquals(Arrays.asList(catKittens.name.asc()), md.getOrderBy());
}
use of com.querydsl.jpa.domain.QCat in project querydsl by querydsl.
the class JPAQueryMutability2Test method clone_.
@Test
public void clone_() {
QCat cat = QCat.cat;
JPAQuery<?> query = query().from(cat).where(cat.name.isNotNull());
JPAQuery<?> query2 = query.clone(entityManager);
assertEquals(query.getMetadata().getJoins(), query2.getMetadata().getJoins());
assertEquals(query.getMetadata().getWhere(), query2.getMetadata().getWhere());
query2.select(cat).fetch();
}
use of com.querydsl.jpa.domain.QCat in project querydsl by querydsl.
the class JPAQueryMutability2Test method test.
@Test
public void test() {
QCat cat = QCat.cat;
JPAQuery<?> query = query().from(cat);
query.fetchCount();
query.distinct().fetchCount();
query.select(cat).iterate();
query.select(cat, cat).iterate();
query.distinct().select(cat).iterate();
query.distinct().select(cat, cat).iterate();
query.select(cat).fetch();
query.select(cat, cat).fetch();
query.distinct().select(cat).fetch();
query.distinct().select(cat, cat).fetch();
query.select(cat).fetchResults();
query.distinct().select(cat).fetchResults();
}
use of com.querydsl.jpa.domain.QCat in project querydsl by querydsl.
the class TupleTest method test.
@Test
// FIXME
@Ignore
public void test() {
QCat cat = QCat.cat;
SubQueryExpression<?> subQuery = select(cat.birthdate, cat.name, cat.mate).from(cat).where(select(cat.mate, cat.birthdate.max()).from(cat).groupBy(cat.mate).contains(Projections.tuple(cat.mate, cat.birthdate)));
assertToString("(select cat.birthdate, cat.name, cat.mate from Cat cat " + "where (cat.mate, cat.birthdate) in " + "(select cat.mate, max(cat.birthdate) from Cat cat group by cat.mate))", subQuery);
}
Aggregations