// Wrap with JoiningJDBCFeatureSource like in DataAccessMappingFeatureIterator
// this is so it'd use the splitFilter in JoiningJDBCFeatureSource
// otherwise you'll get an error when it can't find complex attributes in the
// simple feature source
if (mappedSource instanceof JDBCFeatureSource) {
mappedSource = new JoiningJDBCFeatureSource((JDBCFeatureSource) mappedSource);
} else if (mappedSource instanceof JDBCFeatureStore) {
mappedSource = new JoiningJDBCFeatureSource((JDBCFeatureStore) mappedSource);
}
Query unmappedQuery = unrollQuery(targetQuery, mapping);
return mappedSource.getCount(unmappedQuery);
}