use of com.querydsl.jdo.test.domain.QProduct in project querydsl by querydsl.
the class QueryMutabilityTest method clone_.
@Test
public void clone_() {
QProduct product = QProduct.product;
JDOQuery<?> query = new JDOQuery<Void>().from(product).where(product.name.isNotNull());
JDOQuery<?> query2 = query.clone(pm);
assertEquals(query.getMetadata().getJoins(), query2.getMetadata().getJoins());
assertEquals(query.getMetadata().getWhere(), query2.getMetadata().getWhere());
query2.select(product).fetch();
}
use of com.querydsl.jdo.test.domain.QProduct in project querydsl by querydsl.
the class QueryMutabilityTest method queryMutability.
@Test
public void queryMutability() throws IOException, SecurityException, IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
QProduct product = QProduct.product;
JDOQuery<?> query = query().from(product);
new QueryMutability(query).test(product.name, product.description);
}
use of com.querydsl.jdo.test.domain.QProduct in project querydsl by querydsl.
the class FetchPlanTest method listProducts.
@SuppressWarnings("unchecked")
@Test
public void listProducts() throws Exception {
QProduct product = QProduct.product;
query = query();
query.from(product).where(product.name.startsWith("A")).addFetchGroup("myfetchgroup1").addFetchGroup("myfetchgroup2").setMaxFetchDepth(2).select(product).fetch();
// query.close();
Field queriesField = AbstractJDOQuery.class.getDeclaredField("queries");
queriesField.setAccessible(true);
List<Query> queries = (List<Query>) queriesField.get(query);
Query jdoQuery = queries.get(0);
assertEquals(new HashSet<String>(Arrays.asList("myfetchgroup1", "myfetchgroup2")), jdoQuery.getFetchPlan().getGroups());
assertEquals(2, jdoQuery.getFetchPlan().getMaxFetchDepth());
}