@Override
    public ProcessInstanceLog findProcessInstance(long processInstanceId) {
        EntityManager em = getEntityManager();
        Object newTx = joinTransaction(em);
        try {
        	return (ProcessInstanceLog) em
        	        .createQuery("FROM ProcessInstanceLog p WHERE p.processInstanceId = :processInstanceId")
        	        .setParameter("processInstanceId", processInstanceId).getSingleResult();
        } catch (NoResultException e) {
        	return null;
        } finally {
        	closeEntityManager(em, newTx);
        }
    }
@ Override public ProcessInstanceLog findProcessInstance ( long processInstanceId ) { EntityManager em = getEntityManager ( ) ; Object newTx = joinTransaction ( em ) ; try { return ( ProcessInstanceLog ) em . createQuery ( "FROM ProcessInstanceLog p WHERE p.processInstanceId = :processInstanceId" ) . setParameter ( "processInstanceId" , processInstanceId ) . getSingleResult ( ) ; } catch ( NoResultException e ) { return null ; } finally { closeEntityManager ( em , newTx ) ; } }
/* (non-Javadoc)
@see org.jbpm.process.audit.AuditLogService#findProcessInstance(long)