@Override
	public CPInstance[] findByG_ST_PrevAndNext(long CPInstanceId, long groupId,
		int status, OrderByComparator<CPInstance> orderByComparator)
		throws NoSuchCPInstanceException {
		CPInstance cpInstance = findByPrimaryKey(CPInstanceId);

		Session session = null;

		try {
			session = openSession();

			CPInstance[] array = new CPInstanceImpl[3];

			array[0] = getByG_ST_PrevAndNext(session, cpInstance, groupId,
					status, orderByComparator, true);

			array[1] = cpInstance;

			array[2] = getByG_ST_PrevAndNext(session, cpInstance, groupId,
					status, orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}
@ Override public CPInstance [ ] findByG_ST_PrevAndNext ( long CPInstanceId , long groupId , int status , OrderByComparator < CPInstance > orderByComparator ) throws NoSuchCPInstanceException { CPInstance cpInstance = findByPrimaryKey ( CPInstanceId ) ; Session session = null ; try { session = openSession ( ) ; CPInstance [ ] array = new CPInstanceImpl [ 3 ] ; array [ 0 ] = getByG_ST_PrevAndNext ( session , cpInstance , groupId , status , orderByComparator , true ) ; array [ 1 ] = cpInstance ; array [ 2 ] = getByG_ST_PrevAndNext ( session , cpInstance , groupId , status , orderByComparator , false ) ; return array ; } catch ( Exception e ) { throw processException ( e ) ; } finally { closeSession ( session ) ; } }
Returns the cp instances before and after the current cp instance in the ordered set where groupId = &#63; and status = &#63;.

@param CPInstanceId the primary key of the current cp instance
@param groupId the group ID
@param status the status
@param orderByComparator the comparator to order the set by (optionally <code>null</code>)
@return the previous, current, and next cp instance
@throws NoSuchCPInstanceException if a cp instance with the primary key could not be found