コード例 #1
0
  @Override
  @Transactional
  public Image loadImage(long id) {
    Image image = entityManager.find(Image.class, id);

    if (image != null) {
      // Need this to load domain properties collection
      image.getDomainProperties().size();
    }

    return image;
  }
コード例 #2
0
  @Override
  @Transactional
  public List<Image> loadImages(SearchCriteria searchCriteria) {

    CriteriaQuery<Image> criteriaQuery =
        criteriaSearchHelper.createSearchImagesCriteria(searchCriteria);

    TypedQuery<Image> query = entityManager.createQuery(criteriaQuery);
    query.setFirstResult(0);
    query.setMaxResults(maxImagesPerQuery);

    List<Image> result = query.getResultList();
    if (result != null) {
      for (Image image : result) {
        // Need this to load domain properties collection
        image.getDomainProperties().size();
      }
    }

    return result;
  }