#800 - ENH: Add query.fetchQuery() and query.fetchLazy() ... as nicer alternatives to FetchConfig use

This commit is contained in:
Robin Bygrave
2016-08-02 23:30:04 +12:00
parent 3657d05774
commit b5d6c5f70b
2 changed files with 152 additions and 20 deletions
@@ -43,6 +43,10 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
public static final String DEFAULT_QUERY_NAME = "default";
private static final FetchConfig FETCH_QUERY = new FetchConfig().query();
private static final FetchConfig FETCH_LAZY = new FetchConfig().lazy();
private final Class<T> beanType;
private final BeanDescriptor<T> beanDescriptor;
@@ -1013,6 +1017,16 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
return fetch(property, null, null);
}
@Override
public Query<T> fetchQuery(String property) {
return fetch(property, null, FETCH_QUERY);
}
@Override
public Query<T> fetchLazy(String property) {
return fetch(property, null, FETCH_LAZY);
}
@Override
public DefaultOrmQuery<T> fetch(String property, FetchConfig joinConfig) {
return fetch(property, null, joinConfig);
@@ -1023,6 +1037,16 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
return fetch(property, columns, null);
}
@Override
public Query<T> fetchQuery(String property, String columns) {
return fetch(property, columns, FETCH_QUERY);
}
@Override
public Query<T> fetchLazy(String property, String columns) {
return fetch(property, columns, FETCH_LAZY);
}
@Override
public DefaultOrmQuery<T> fetch(String property, String columns, FetchConfig config) {
detail.fetch(property, columns, config);