public AuthSource findByStrategy ( String strategy ) { EntityManager entityManager = getEntityManager ( ) ; CriteriaBuilder criteriaBuilder = entityManager . getCriteriaBuilder ( ) ; CriteriaQuery < AuthSource > criteria = criteriaBuilder . createQuery ( AuthSource . class ) ; Root < AuthSource > root = criteria . from ( AuthSource . class ) ; criteria . select ( root ) ; criteria . where ( criteriaBuilder . equal ( root . get ( AuthSource_ . strategy ) , strategy ) ) ; return getSingleResult ( entityManager . createQuery ( criteria ) ) ; }
Finds an auth source by strategy