TypeImpl type = ((MetamodelImpl)this.metamodel).getType(selection.getJavaType());
if (type != null && type.getPersistenceType().equals(PersistenceType.ENTITY)) {
query = new ReadAllQuery(type.getJavaType());
List<org.eclipse.persistence.expressions.Expression> list = ((FromImpl) this.roots.iterator().next()).findJoinFetches();
for (org.eclipse.persistence.expressions.Expression fetch : list) {
query.addJoinedAttribute(fetch);
}
if (!list.isEmpty()) {
query.setShouldFilterDuplicates(false);
}
query.setExpressionBuilder(((InternalSelection)selection).getCurrentNode().getBuilder());