public static SuspensionRecord findByUserAndSubsystem(EntityManager em, PrincipalUser user, SubSystem subSystem) {
        TypedQuery<SuspensionRecord> query = em.createNamedQuery("SuspensionRecord.findByUserAndSubsystem", SuspensionRecord.class);

        try {
            query.setParameter("user", user);
            query.setParameter("subSystem", subSystem);
            query.setHint("javax.persistence.cache.storeMode", "REFRESH");
            return query.getSingleResult();
        } catch (NoResultException ex) {
            return null;
        }
    }
public static SuspensionRecord findByUserAndSubsystem ( EntityManager em , PrincipalUser user , SubSystem subSystem ) { TypedQuery < SuspensionRecord > query = em . createNamedQuery ( "SuspensionRecord.findByUserAndSubsystem" , SuspensionRecord . class ) ; try { query . setParameter ( "user" , user ) ; query . setParameter ( "subSystem" , subSystem ) ; query . setHint ( "javax.persistence.cache.storeMode" , "REFRESH" ) ; return query . getSingleResult ( ) ; } catch ( NoResultException ex ) { return null ; } }
Find the suspension record for a given user-subsystem combination.

@param   em         The EntityManager to use.
@param   user       The user for which to retrieve record.
@param   subSystem  THe subsystem for which to retrieve record.

@return  The suspension record for the given user-subsystem combination. Null if no such record exists.