Search in sources :

Example 1 with QStore

use of com.querydsl.jdo.test.domain.QStore in project querydsl by querydsl.

the class FetchPlanTest method listStores.

@SuppressWarnings("unchecked")
@Test
public void listStores() throws Exception {
    QStore store = QStore.store;
    query = query();
    query.from(store).addFetchGroup("products").select(store).fetch();
    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("products")), jdoQuery.getFetchPlan().getGroups());
    assertEquals(1, jdoQuery.getFetchPlan().getMaxFetchDepth());
}
Also used : QStore(com.querydsl.jdo.test.domain.QStore) Field(java.lang.reflect.Field) Query(javax.jdo.Query) List(java.util.List) Test(org.junit.Test)

Aggregations

QStore (com.querydsl.jdo.test.domain.QStore)1 Field (java.lang.reflect.Field)1 List (java.util.List)1 Query (javax.jdo.Query)1 Test (org.junit.Test)1