use of com.querydsl.core.types.Predicate in project querydsl by querydsl.
the class DocumentTest method test1.
@Test
public void test1() {
Predicate crit = qDoc.id.eq(3L);
List<Document> expResult = CollQueryFactory.from(qDoc, doc1, doc2, doc3).where(crit).fetch();
//ok
assertTrue(expResult.contains(doc3));
}
use of com.querydsl.core.types.Predicate in project querydsl by querydsl.
the class DocumentTest method test2.
@Test
public void test2() {
Predicate crit = qDoc.meshThesaurusTerms.any().eq("x");
List<Document> expResult = CollQueryFactory.from(qDoc, doc1, doc2, doc3).where(crit).fetch();
//ok
assertTrue(expResult.contains(doc1));
}
use of com.querydsl.core.types.Predicate in project querydsl by querydsl.
the class DocumentTest method test3.
@Test
public void test3() {
Predicate crit = qDoc.meshThesaurusTerms.any().eq("x").or(qDoc.id.eq(3L));
List<Document> expResult = CollQueryFactory.from(qDoc, doc1, doc2, doc3).where(crit).fetch();
assertTrue(expResult.contains(doc1));
//fails, expResult contains only doc1, but should contain doc1 and doc3!
assertTrue(expResult.contains(doc3));
}
use of com.querydsl.core.types.Predicate in project querydsl by querydsl.
the class JPACollectionAnyVisitorTest method nested_any_booleanOperation.
@Test
public void nested_any_booleanOperation() {
QCompany company = QCompany.company;
Predicate predicate = company.departments.any().employees.any().firstName.eq("Bob");
assertEquals("exists (select 1\n" + "from company.departments as company_departments_0\n" + " inner join company_departments_0.employees as company_departments_0_employees_1\n" + "where company_departments_0_employees_1.firstName = ?1)", serialize(predicate));
}
use of com.querydsl.core.types.Predicate in project querydsl by querydsl.
the class JPACollectionAnyVisitorTest method simple_booleanOperation_longPath.
@Test
public void simple_booleanOperation_longPath() {
Predicate predicate = cat.kittens.any().kittens.any().name.eq("Ruth123");
assertEquals("exists (select 1\n" + "from cat.kittens as cat_kittens_0\n" + " inner join cat_kittens_0.kittens as cat_kittens_0_kittens_1\n" + "where cat_kittens_0_kittens_1.name = ?1)", serialize(predicate));
}
Aggregations