@Test public void testFindByNameSuccess() { final long expectedId = 4565; assertEquals(expectedId, jpaGalleryItemCategoryMapper.findByName(GalleryItemType.GADGET, name).getId()); }
@SuppressWarnings("unchecked") public GalleryItemCategory findByName(final GalleryItemType inGalleryItemType, final String inName) { Query q = getEntityManager().createQuery("from GalleryItemCategory where " + "galleryItemType = :galleryItemType and name = :inName") .setParameter("galleryItemType", inGalleryItemType) .setParameter("inName", inName); List results = q.getResultList(); return (results.size() == 0) ? null : (GalleryItemCategory) results.get(0); }
GalleryItemCategoryMapper extends DomainEntityMapper<GalleryItemCategory> { @SuppressWarnings("unchecked") public GalleryItemCategory findByName(final GalleryItemType inGalleryItemType, final String inName) { Query q = getEntityManager().createQuery("from GalleryItemCategory where " + "galleryItemType = :galleryItemType and name = :inName") .setParameter("galleryItemType", inGalleryItemType) .setParameter("inName", inName); List results = q.getResultList(); return (results.size() == 0) ? null : (GalleryItemCategory) results.get(0); } }
GalleryItemCategoryMapper extends DomainEntityMapper<GalleryItemCategory> { @SuppressWarnings("unchecked") public GalleryItemCategory findByName(final GalleryItemType inGalleryItemType, final String inName) { Query q = getEntityManager().createQuery("from GalleryItemCategory where " + "galleryItemType = :galleryItemType and name = :inName") .setParameter("galleryItemType", inGalleryItemType) .setParameter("inName", inName); List results = q.getResultList(); return (results.size() == 0) ? null : (GalleryItemCategory) results.get(0); } GalleryItemCategoryMapper(final QueryOptimizer inQueryOptimizer); }
GalleryItemCategoryMapper extends DomainEntityMapper<GalleryItemCategory> { @SuppressWarnings("unchecked") public GalleryItemCategory findByName(final GalleryItemType inGalleryItemType, final String inName) { Query q = getEntityManager().createQuery("from GalleryItemCategory where " + "galleryItemType = :galleryItemType and name = :inName") .setParameter("galleryItemType", inGalleryItemType) .setParameter("inName", inName); List results = q.getResultList(); return (results.size() == 0) ? null : (GalleryItemCategory) results.get(0); } GalleryItemCategoryMapper(final QueryOptimizer inQueryOptimizer); @SuppressWarnings("unchecked") GalleryItemCategory findByName(final GalleryItemType inGalleryItemType, final String inName); @SuppressWarnings("unchecked") List<GalleryItemCategory> findGalleryItemCategories(final GalleryItemType inGalleryItemType); }
GalleryItemCategoryMapper extends DomainEntityMapper<GalleryItemCategory> { @SuppressWarnings("unchecked") public GalleryItemCategory findByName(final GalleryItemType inGalleryItemType, final String inName) { Query q = getEntityManager().createQuery("from GalleryItemCategory where " + "galleryItemType = :galleryItemType and name = :inName") .setParameter("galleryItemType", inGalleryItemType) .setParameter("inName", inName); List results = q.getResultList(); return (results.size() == 0) ? null : (GalleryItemCategory) results.get(0); } GalleryItemCategoryMapper(final QueryOptimizer inQueryOptimizer); @SuppressWarnings("unchecked") GalleryItemCategory findByName(final GalleryItemType inGalleryItemType, final String inName); @SuppressWarnings("unchecked") List<GalleryItemCategory> findGalleryItemCategories(final GalleryItemType inGalleryItemType);  }