@Override
	public CommerceSubscriptionEntry fetchByC_C_C(String CPInstanceUuid,
		long CProductId, long commerceOrderItemId, boolean retrieveFromCache) {
		Object[] finderArgs = new Object[] {
				CPInstanceUuid, CProductId, commerceOrderItemId
			};

		Object result = null;

		if (retrieveFromCache) {
			result = finderCache.getResult(FINDER_PATH_FETCH_BY_C_C_C,
					finderArgs, this);
		}

		if (result instanceof CommerceSubscriptionEntry) {
			CommerceSubscriptionEntry commerceSubscriptionEntry = (CommerceSubscriptionEntry)result;

			if (!Objects.equals(CPInstanceUuid,
						commerceSubscriptionEntry.getCPInstanceUuid()) ||
					(CProductId != commerceSubscriptionEntry.getCProductId()) ||
					(commerceOrderItemId != commerceSubscriptionEntry.getCommerceOrderItemId())) {
				result = null;
			}
		}

		if (result == null) {
			StringBundler query = new StringBundler(5);

			query.append(_SQL_SELECT_COMMERCESUBSCRIPTIONENTRY_WHERE);

			boolean bindCPInstanceUuid = false;

			if (CPInstanceUuid == null) {
				query.append(_FINDER_COLUMN_C_C_C_CPINSTANCEUUID_1);
			}
			else if (CPInstanceUuid.equals("")) {
				query.append(_FINDER_COLUMN_C_C_C_CPINSTANCEUUID_3);
			}
			else {
				bindCPInstanceUuid = true;

				query.append(_FINDER_COLUMN_C_C_C_CPINSTANCEUUID_2);
			}

			query.append(_FINDER_COLUMN_C_C_C_CPRODUCTID_2);

			query.append(_FINDER_COLUMN_C_C_C_COMMERCEORDERITEMID_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				if (bindCPInstanceUuid) {
					qPos.add(CPInstanceUuid);
				}

				qPos.add(CProductId);

				qPos.add(commerceOrderItemId);

				List<CommerceSubscriptionEntry> list = q.list();

				if (list.isEmpty()) {
					finderCache.putResult(FINDER_PATH_FETCH_BY_C_C_C,
						finderArgs, list);
				}
				else {
					CommerceSubscriptionEntry commerceSubscriptionEntry = list.get(0);

					result = commerceSubscriptionEntry;

					cacheResult(commerceSubscriptionEntry);
				}
			}
			catch (Exception e) {
				finderCache.removeResult(FINDER_PATH_FETCH_BY_C_C_C, finderArgs);

				throw processException(e);
			}
			finally {
				closeSession(session);
			}
		}

		if (result instanceof List<?>) {
			return null;
		}
		else {
			return (CommerceSubscriptionEntry)result;
		}
	}
@ Override public CommerceSubscriptionEntry fetchByC_C_C ( String CPInstanceUuid , long CProductId , long commerceOrderItemId , boolean retrieveFromCache ) { Object [ ] finderArgs = new Object [ ] { CPInstanceUuid , CProductId , commerceOrderItemId } ; Object result = null ; if ( retrieveFromCache ) { result = finderCache . getResult ( FINDER_PATH_FETCH_BY_C_C_C , finderArgs , this ) ; } if ( result instanceof CommerceSubscriptionEntry ) { CommerceSubscriptionEntry commerceSubscriptionEntry = ( CommerceSubscriptionEntry ) result ; if ( ! Objects . equals ( CPInstanceUuid , commerceSubscriptionEntry . getCPInstanceUuid ( ) ) || ( CProductId != commerceSubscriptionEntry . getCProductId ( ) ) || ( commerceOrderItemId != commerceSubscriptionEntry . getCommerceOrderItemId ( ) ) ) { result = null ; } } if ( result == null ) { StringBundler query = new StringBundler ( 5 ) ; query . append ( _SQL_SELECT_COMMERCESUBSCRIPTIONENTRY_WHERE ) ; boolean bindCPInstanceUuid = false ; if ( CPInstanceUuid == null ) { query . append ( _FINDER_COLUMN_C_C_C_CPINSTANCEUUID_1 ) ; } else if ( CPInstanceUuid . equals ( "" ) ) { query . append ( _FINDER_COLUMN_C_C_C_CPINSTANCEUUID_3 ) ; } else { bindCPInstanceUuid = true ; query . append ( _FINDER_COLUMN_C_C_C_CPINSTANCEUUID_2 ) ; } query . append ( _FINDER_COLUMN_C_C_C_CPRODUCTID_2 ) ; query . append ( _FINDER_COLUMN_C_C_C_COMMERCEORDERITEMID_2 ) ; String sql = query . toString ( ) ; Session session = null ; try { session = openSession ( ) ; Query q = session . createQuery ( sql ) ; QueryPos qPos = QueryPos . getInstance ( q ) ; if ( bindCPInstanceUuid ) { qPos . add ( CPInstanceUuid ) ; } qPos . add ( CProductId ) ; qPos . add ( commerceOrderItemId ) ; List < CommerceSubscriptionEntry > list = q . list ( ) ; if ( list . isEmpty ( ) ) { finderCache . putResult ( FINDER_PATH_FETCH_BY_C_C_C , finderArgs , list ) ; } else { CommerceSubscriptionEntry commerceSubscriptionEntry = list . get ( 0 ) ; result = commerceSubscriptionEntry ; cacheResult ( commerceSubscriptionEntry ) ; } } catch ( Exception e ) { finderCache . removeResult ( FINDER_PATH_FETCH_BY_C_C_C , finderArgs ) ; throw processException ( e ) ; } finally { closeSession ( session ) ; } } if ( result instanceof List < ? > ) { return null ; } else { return ( CommerceSubscriptionEntry ) result ; } }
Returns the commerce subscription entry where CPInstanceUuid = &#63; and CProductId = &#63; and commerceOrderItemId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.

@param CPInstanceUuid the cp instance uuid
@param CProductId the c product ID
@param commerceOrderItemId the commerce order item ID
@param retrieveFromCache whether to retrieve from the finder cache
@return the matching commerce subscription entry, or <code>null</code> if a matching commerce subscription entry could not be found