@Override
	public CPInstance fetchByPrimaryKey(Serializable primaryKey) {
		Serializable serializable = entityCache.getResult(CPInstanceModelImpl.ENTITY_CACHE_ENABLED,
				CPInstanceImpl.class, primaryKey);

		if (serializable == nullModel) {
			return null;
		}

		CPInstance cpInstance = (CPInstance)serializable;

		if (cpInstance == null) {
			Session session = null;

			try {
				session = openSession();

				cpInstance = (CPInstance)session.get(CPInstanceImpl.class,
						primaryKey);

				if (cpInstance != null) {
					cacheResult(cpInstance);
				}
				else {
					entityCache.putResult(CPInstanceModelImpl.ENTITY_CACHE_ENABLED,
						CPInstanceImpl.class, primaryKey, nullModel);
				}
			}
			catch (Exception e) {
				entityCache.removeResult(CPInstanceModelImpl.ENTITY_CACHE_ENABLED,
					CPInstanceImpl.class, primaryKey);

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

		return cpInstance;
	}
@ Override public CPInstance fetchByPrimaryKey ( Serializable primaryKey ) { Serializable serializable = entityCache . getResult ( CPInstanceModelImpl . ENTITY_CACHE_ENABLED , CPInstanceImpl . class , primaryKey ) ; if ( serializable == nullModel ) { return null ; } CPInstance cpInstance = ( CPInstance ) serializable ; if ( cpInstance == null ) { Session session = null ; try { session = openSession ( ) ; cpInstance = ( CPInstance ) session . get ( CPInstanceImpl . class , primaryKey ) ; if ( cpInstance != null ) { cacheResult ( cpInstance ) ; } else { entityCache . putResult ( CPInstanceModelImpl . ENTITY_CACHE_ENABLED , CPInstanceImpl . class , primaryKey , nullModel ) ; } } catch ( Exception e ) { entityCache . removeResult ( CPInstanceModelImpl . ENTITY_CACHE_ENABLED , CPInstanceImpl . class , primaryKey ) ; throw processException ( e ) ; } finally { closeSession ( session ) ; } } return cpInstance ; }
Returns the cp instance with the primary key or returns <code>null</code> if it could not be found.

@param primaryKey the primary key of the cp instance
@return the cp instance, or <code>null</code> if a cp instance with the primary key could not be found