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 .