use of com.querydsl.core.types.Predicate in project querydsl by querydsl.
the class QueryByExampleTest method name_not_set.
@Test
public void name_not_set() {
ExampleEntity entity = new ExampleEntity();
Predicate qbe = QExampleEntity.exampleEntity.like(entity);
assertNull(qbe);
}
use of com.querydsl.core.types.Predicate in project querydsl by querydsl.
the class QueryByExampleTest method name_set.
@Test
public void name_set() {
ExampleEntity entity = new ExampleEntity();
entity.name = "XXX";
Predicate qbe = QExampleEntity.exampleEntity.like(entity);
assertEquals("exampleEntity.name = XXX", qbe.toString());
}
use of com.querydsl.core.types.Predicate in project querydsl by querydsl.
the class DocumentTest method test4.
@Test
public void test4() {
Predicate crit = qDoc.id.eq(3L).or(qDoc.meshThesaurusTerms.any().eq("x"));
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 CollectionAnyVisitorTest method simple_booleanOperation.
@Test
public void simple_booleanOperation() {
Predicate predicate = cat.kittens.any().name.eq("Ruth123");
assertEquals("cat_kittens_0.name = Ruth123", serialize(predicate));
}
use of com.querydsl.core.types.Predicate in project querydsl by querydsl.
the class SerializationBase method any_serialized2.
@Test
public void any_serialized2() throws Exception {
Predicate where = cat.kittens.any().name.eq("Ruth234");
File file = new File("target", "predicate.ser");
if (!file.exists()) {
// serialize predicate on first run
FileOutputStream fileOutputStream = new FileOutputStream(file);
ObjectOutputStream out = new ObjectOutputStream(fileOutputStream);
out.writeObject(where);
out.close();
assertEquals(0, query().from(cat).where(where).fetchCount());
} else {
// deserialize predicate on second run
FileInputStream fileInputStream = new FileInputStream(file);
ObjectInputStream in = new ObjectInputStream(fileInputStream);
Predicate where2 = (Predicate) in.readObject();
in.close();
assertEquals(0, query().from(cat).where(where2).fetchCount());
}
}
Aggregations