Search in sources :

Example 21 with Predicate

use of com.querydsl.core.types.Predicate in project querydsl by querydsl.

the class JPACollectionAnyVisitorTest method cast.

@Test
public void cast() {
    //        JPAQuery query = new JPAQuery(em).from(QPerson.person);
    //        QDog anyDog = QPerson.person.animals.any().as(QDog.class);
    //        query.where(anyDog.gender.eq("M"));
    //        List<Person> foundOwners = query.fetch(QPerson.person);
    QDomesticCat anyCat = QCat.cat.kittens.any().as(QDomesticCat.class);
    Predicate predicate = anyCat.name.eq("X");
    assertEquals("exists (select 1\n" + "from cat.kittens as cat_kittens_0\n" + "where cat_kittens_0.name = ?1)", serialize(predicate));
}
Also used : QDomesticCat(com.querydsl.jpa.domain.QDomesticCat) Predicate(com.querydsl.core.types.Predicate) Test(org.junit.Test)

Example 22 with Predicate

use of com.querydsl.core.types.Predicate in project querydsl by querydsl.

the class JPACollectionAnyVisitorTest method simple_booleanOperation.

@Test
public void simple_booleanOperation() {
    Predicate predicate = cat.kittens.any().name.eq("Ruth123");
    assertEquals("exists (select 1\n" + "from cat.kittens as cat_kittens_0\n" + "where cat_kittens_0.name = ?1)", serialize(predicate));
}
Also used : Predicate(com.querydsl.core.types.Predicate) Test(org.junit.Test)

Aggregations

Predicate (com.querydsl.core.types.Predicate)22 Test (org.junit.Test)20 QCat (com.querydsl.core.domain.QCat)1 Context (com.querydsl.core.support.Context)1 StringPath (com.querydsl.core.types.dsl.StringPath)1 QCompany (com.querydsl.jpa.domain.QCompany)1 QDomesticCat (com.querydsl.jpa.domain.QDomesticCat)1 QEmployee (com.querydsl.jpa.domain.QEmployee)1