@Override
	public CommerceDiscountRel fetchByCD_CN_Last(long commerceDiscountId,
		long classNameId,
		OrderByComparator<CommerceDiscountRel> orderByComparator) {
		int count = countByCD_CN(commerceDiscountId, classNameId);

		if (count == 0) {
			return null;
		}

		List<CommerceDiscountRel> list = findByCD_CN(commerceDiscountId,
				classNameId, count - 1, count, orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}
@ Override public CommerceDiscountRel fetchByCD_CN_Last ( long commerceDiscountId , long classNameId , OrderByComparator < CommerceDiscountRel > orderByComparator ) { int count = countByCD_CN ( commerceDiscountId , classNameId ) ; if ( count == 0 ) { return null ; } List < CommerceDiscountRel > list = findByCD_CN ( commerceDiscountId , classNameId , count - 1 , count , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ; }
Returns the last commerce discount rel in the ordered set where commerceDiscountId = &#63; and classNameId = &#63;.

@param commerceDiscountId the commerce discount ID
@param classNameId the class name ID
@param orderByComparator the comparator to order the set by (optionally <code>null</code>)
@return the last matching commerce discount rel, or <code>null</code> if a matching commerce discount rel could not be found