@Override
	public CommerceWishListItem fetchByCW_CPI_CP(long commerceWishListId,
		String CPInstanceUuid, long CProductId, boolean retrieveFromCache) {
		Object[] finderArgs = new Object[] {
				commerceWishListId, CPInstanceUuid, CProductId
			};

		Object result = null;

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

		if (result instanceof CommerceWishListItem) {
			CommerceWishListItem commerceWishListItem = (CommerceWishListItem)result;

			if ((commerceWishListId != commerceWishListItem.getCommerceWishListId()) ||
					!Objects.equals(CPInstanceUuid,
						commerceWishListItem.getCPInstanceUuid()) ||
					(CProductId != commerceWishListItem.getCProductId())) {
				result = null;
			}
		}

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

			query.append(_SQL_SELECT_COMMERCEWISHLISTITEM_WHERE);

			query.append(_FINDER_COLUMN_CW_CPI_CP_COMMERCEWISHLISTID_2);

			boolean bindCPInstanceUuid = false;

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

				query.append(_FINDER_COLUMN_CW_CPI_CP_CPINSTANCEUUID_2);
			}

			query.append(_FINDER_COLUMN_CW_CPI_CP_CPRODUCTID_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(commerceWishListId);

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

				qPos.add(CProductId);

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

				if (list.isEmpty()) {
					finderCache.putResult(FINDER_PATH_FETCH_BY_CW_CPI_CP,
						finderArgs, list);
				}
				else {
					if (list.size() > 1) {
						Collections.sort(list, Collections.reverseOrder());

						if (_log.isWarnEnabled()) {
							_log.warn(
								"CommerceWishListItemPersistenceImpl.fetchByCW_CPI_CP(long, String, long, boolean) with parameters (" +
								StringUtil.merge(finderArgs) +
								") yields a result set with more than 1 result. This violates the logical unique restriction. There is no order guarantee on which result is returned by this finder.");
						}
					}

					CommerceWishListItem commerceWishListItem = list.get(0);

					result = commerceWishListItem;

					cacheResult(commerceWishListItem);
				}
			}
			catch (Exception e) {
				finderCache.removeResult(FINDER_PATH_FETCH_BY_CW_CPI_CP,
					finderArgs);

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

		if (result instanceof List<?>) {
			return null;
		}
		else {
			return (CommerceWishListItem)result;
		}
	}
@ Override public CommerceWishListItem fetchByCW_CPI_CP ( long commerceWishListId , String CPInstanceUuid , long CProductId , boolean retrieveFromCache ) { Object [ ] finderArgs = new Object [ ] { commerceWishListId , CPInstanceUuid , CProductId } ; Object result = null ; if ( retrieveFromCache ) { result = finderCache . getResult ( FINDER_PATH_FETCH_BY_CW_CPI_CP , finderArgs , this ) ; } if ( result instanceof CommerceWishListItem ) { CommerceWishListItem commerceWishListItem = ( CommerceWishListItem ) result ; if ( ( commerceWishListId != commerceWishListItem . getCommerceWishListId ( ) ) || ! Objects . equals ( CPInstanceUuid , commerceWishListItem . getCPInstanceUuid ( ) ) || ( CProductId != commerceWishListItem . getCProductId ( ) ) ) { result = null ; } } if ( result == null ) { StringBundler query = new StringBundler ( 5 ) ; query . append ( _SQL_SELECT_COMMERCEWISHLISTITEM_WHERE ) ; query . append ( _FINDER_COLUMN_CW_CPI_CP_COMMERCEWISHLISTID_2 ) ; boolean bindCPInstanceUuid = false ; if ( CPInstanceUuid == null ) { query . append ( _FINDER_COLUMN_CW_CPI_CP_CPINSTANCEUUID_1 ) ; } else if ( CPInstanceUuid . equals ( "" ) ) { query . append ( _FINDER_COLUMN_CW_CPI_CP_CPINSTANCEUUID_3 ) ; } else { bindCPInstanceUuid = true ; query . append ( _FINDER_COLUMN_CW_CPI_CP_CPINSTANCEUUID_2 ) ; } query . append ( _FINDER_COLUMN_CW_CPI_CP_CPRODUCTID_2 ) ; String sql = query . toString ( ) ; Session session = null ; try { session = openSession ( ) ; Query q = session . createQuery ( sql ) ; QueryPos qPos = QueryPos . getInstance ( q ) ; qPos . add ( commerceWishListId ) ; if ( bindCPInstanceUuid ) { qPos . add ( CPInstanceUuid ) ; } qPos . add ( CProductId ) ; List < CommerceWishListItem > list = q . list ( ) ; if ( list . isEmpty ( ) ) { finderCache . putResult ( FINDER_PATH_FETCH_BY_CW_CPI_CP , finderArgs , list ) ; } else { if ( list . size ( ) > 1 ) { Collections . sort ( list , Collections . reverseOrder ( ) ) ; if ( _log . isWarnEnabled ( ) ) { _log . warn ( "CommerceWishListItemPersistenceImpl.fetchByCW_CPI_CP(long, String, long, boolean) with parameters (" + StringUtil . merge ( finderArgs ) + ") yields a result set with more than 1 result. This violates the logical unique restriction. There is no order guarantee on which result is returned by this finder." ) ; } } CommerceWishListItem commerceWishListItem = list . get ( 0 ) ; result = commerceWishListItem ; cacheResult ( commerceWishListItem ) ; } } catch ( Exception e ) { finderCache . removeResult ( FINDER_PATH_FETCH_BY_CW_CPI_CP , finderArgs ) ; throw processException ( e ) ; } finally { closeSession ( session ) ; } } if ( result instanceof List < ? > ) { return null ; } else { return ( CommerceWishListItem ) result ; } }
Returns the commerce wish list item where commerceWishListId = &#63; and CPInstanceUuid = &#63; and CProductId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.

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