Search in sources :

Example 1 with QueryMetadata

use of com.querydsl.core.QueryMetadata in project querydsl by querydsl.

the class JPAQueryMixinTest method orderBy_groupBy.

@Test
public void orderBy_groupBy() {
    QCat cat = QCat.cat;
    mixin.from(cat);
    mixin.groupBy(cat.mate.name);
    mixin.orderBy(cat.mate.name.asc());
    QueryMetadata md = mixin.getMetadata();
    assertEquals(Collections.singletonList(new JoinExpression(JoinType.DEFAULT, cat)), md.getJoins());
    assertEquals(Collections.singletonList(cat.mate.name.asc()), md.getOrderBy());
}
Also used : QCat(com.querydsl.jpa.domain.QCat) QueryMetadata(com.querydsl.core.QueryMetadata) JoinExpression(com.querydsl.core.JoinExpression) Test(org.junit.Test)

Example 2 with QueryMetadata

use of com.querydsl.core.QueryMetadata in project querydsl by querydsl.

the class JPAQueryMixinTest method orderBy_operation.

@Test
public void orderBy_operation() {
    QCat cat = QCat.cat;
    QCat catMate = new QCat("cat_mate");
    mixin.from(cat);
    mixin.orderBy(cat.mate.name.lower().asc());
    QueryMetadata md = mixin.getMetadata();
    assertEquals(Arrays.asList(new JoinExpression(JoinType.DEFAULT, cat), new JoinExpression(JoinType.LEFTJOIN, cat.mate.as(catMate))), md.getJoins());
    assertEquals(Collections.singletonList(catMate.name.lower().asc()), md.getOrderBy());
}
Also used : QCat(com.querydsl.jpa.domain.QCat) QueryMetadata(com.querydsl.core.QueryMetadata) JoinExpression(com.querydsl.core.JoinExpression) Test(org.junit.Test)

Example 3 with QueryMetadata

use of com.querydsl.core.QueryMetadata in project querydsl by querydsl.

the class JPAQueryMixinTest method orderBy_long_reuse.

@Test
public void orderBy_long_reuse() {
    QCat cat = QCat.cat;
    QCat mate = new QCat("mate");
    QCat mateMate = new QCat("mate_mate");
    mixin.from(cat);
    mixin.leftJoin(cat.mate, mate);
    mixin.orderBy(cat.mate.mate.name.asc());
    QueryMetadata md = mixin.getMetadata();
    assertEquals(Arrays.asList(new JoinExpression(JoinType.DEFAULT, cat), new JoinExpression(JoinType.LEFTJOIN, cat.mate.as(mate)), new JoinExpression(JoinType.LEFTJOIN, mate.mate.as(mateMate))), md.getJoins());
    assertEquals(Collections.singletonList(mateMate.name.asc()), md.getOrderBy());
}
Also used : QCat(com.querydsl.jpa.domain.QCat) QueryMetadata(com.querydsl.core.QueryMetadata) JoinExpression(com.querydsl.core.JoinExpression) Test(org.junit.Test)

Example 4 with QueryMetadata

use of com.querydsl.core.QueryMetadata in project querydsl by querydsl.

the class JPAQueryMixinTest method orderBy_embeddable2.

@SuppressWarnings("unchecked")
@Test
public void orderBy_embeddable2() {
    QArticle article = QArticle.article;
    QArticle articleContentArticle = new QArticle("article_content_article");
    mixin.from(article);
    mixin.orderBy(article.content.article.name.asc());
    QueryMetadata md = mixin.getMetadata();
    assertEquals(Arrays.asList(new JoinExpression(JoinType.DEFAULT, article), new JoinExpression(JoinType.LEFTJOIN, article.content.article.as(articleContentArticle))), md.getJoins());
    assertEquals(Collections.singletonList(articleContentArticle.name.asc()), md.getOrderBy());
}
Also used : QueryMetadata(com.querydsl.core.QueryMetadata) JoinExpression(com.querydsl.core.JoinExpression) Test(org.junit.Test)

Example 5 with QueryMetadata

use of com.querydsl.core.QueryMetadata in project querydsl by querydsl.

the class JPAQueryMixinTest method orderBy_long.

@Test
public void orderBy_long() {
    QCat cat = QCat.cat;
    QCat catMate = new QCat("cat_mate");
    QCat catMateMate = new QCat("cat_mate_mate");
    mixin.from(cat);
    mixin.orderBy(cat.mate.mate.name.asc());
    QueryMetadata md = mixin.getMetadata();
    assertEquals(Arrays.asList(new JoinExpression(JoinType.DEFAULT, cat), new JoinExpression(JoinType.LEFTJOIN, cat.mate.as(catMate)), new JoinExpression(JoinType.LEFTJOIN, catMate.mate.as(catMateMate))), md.getJoins());
    assertEquals(Collections.singletonList(catMateMate.name.asc()), md.getOrderBy());
}
Also used : QCat(com.querydsl.jpa.domain.QCat) QueryMetadata(com.querydsl.core.QueryMetadata) JoinExpression(com.querydsl.core.JoinExpression) Test(org.junit.Test)

Aggregations

QueryMetadata (com.querydsl.core.QueryMetadata)44 Test (org.junit.Test)35 DefaultQueryMetadata (com.querydsl.core.DefaultQueryMetadata)24 JoinExpression (com.querydsl.core.JoinExpression)16 QCat (com.querydsl.core.domain.QCat)8 QCat (com.querydsl.jpa.domain.QCat)8 StringPath (com.querydsl.core.types.dsl.StringPath)6 OrderSpecifier (com.querydsl.core.types.OrderSpecifier)4 EmptyCloseableIterator (com.mysema.commons.lang.EmptyCloseableIterator)3 QueryException (com.querydsl.core.QueryException)3 IOException (java.io.IOException)3 ScoreDoc (org.apache.lucene.search.ScoreDoc)3 Sort (org.apache.lucene.search.Sort)3 Tuple (com.querydsl.core.Tuple)2 Path (com.querydsl.core.types.Path)2 QEmployee (com.querydsl.jpa.domain.QEmployee)2 QBookVersion (com.querydsl.jpa.domain4.QBookVersion)2 LuceneSerializer (com.querydsl.lucene5.LuceneSerializer)2 QEmployee (com.querydsl.sql.domain.QEmployee)2 ArrayList (java.util.ArrayList)2