CriteriaQuery<Product> criteria = builder.createQuery(Product.class);
Root<ProductImpl> product = criteria.from(ProductImpl.class);
FetchParent fetchParent = product.fetch("defaultSku", JoinType.LEFT);
if (!dialectHelper.isOracle() && !dialectHelper.isSqlServer()) {
fetchParent.fetch("skuMedia", JoinType.LEFT);
}
criteria.select(product);
// We only want results that match the product IDs
criteria.where(product.get("id").as(Long.class).in(