ProductCategoryServiceImpl extends BaseGenericServiceImpl<ProductCategory> implements ProductCategoryService { @Override public ProductCategory findByCategoryIdProductId(final long categoryId, final long productId) { return getGenericDao().findSingleByNamedQuery("PRODUCT.IN.CATEGORY", categoryId, productId); } ProductCategoryServiceImpl(final GenericDAO<ProductCategory, Long> productCategoryDao); @Override ProductCategory findByCategoryIdProductId(final long categoryId, final long productId); @Override List<Long> getByProductId(final long productId); @Override List<ProductCategory> findByProductId(final long productId); @Override void removeByCategoryProductIds(final long categoryId, final long productId); @Override void removeByProductIds(final long productId); @Override int getNextRank(final long categoryId);  }
@Test public void testFindByCategoryIdProductId() { ProductCategoryService productCategoryService = (ProductCategoryService) ctx().getBean(ServiceSpringKeys.PRODUCT_CATEGORY_SERVICE); assertNotNull(productCategoryService.findByCategoryIdProductId(101, 10000)); assertNull(productCategoryService.findByCategoryIdProductId(101, 11000)); }