public < T , Y > List < T > getListByAttribute ( Class < T > entityCls , SingularAttribute < T , Y > attribute , Y value ) { if ( entityCls == null ) { throw new IllegalArgumentException ( "entityCls cannot be null" ) ; } if ( attribute == null ) { throw new IllegalArgumentException ( "attribute cannot be null" ) ; } TypedQuery < T > query = createTypedQuery ( entityCls , attribute , value ) ; return query . getResultList ( ) ; }
Executes a query for the entities that have the specified value of the given attribute .