public static PrincipalUser findByUserName ( EntityManager em , String userName ) { Class < PrincipalUser > type = PrincipalUser . class ; TypedQuery < PrincipalUser > query = em . createNamedQuery ( "PrincipalUser.findByUserName" , type ) ; try { return query . setParameter ( "userName" , userName ) . getSingleResult ( ) ; } catch ( NoResultException ex ) { return null ; } }
Finds the application database user account for the provided user name .