public static <E extends Identifiable>List<E> findByPrimaryKeys(EntityManager em,List<BigInteger> ids,Class<E> type){
  requireArgument(em != null,"The entity manager cannot be null.");
  requireArgument(ids != null && !ids.isEmpty(),"IDs cannot be null or empty.");
  requireArgument(type != null,"The entity type cannot be null.");
  TypedQuery<E> query=em.createNamedQuery("JPAEntity.findByPrimaryKeys",type);
  query.setHint("javax.persistence.cache.storeMode","REFRESH");
  try {
    query.setParameter("ids",ids);
    query.setParameter("deleted",false);
    return query.getResultList();
  }
 catch (  NoResultException ex) {
    return new ArrayList<>(0);
  }
}

public static < E extends Identifiable > List < E > findByPrimaryKeys ( EntityManager em , List < BigInteger > ids , Class < E > type ) { requireArgument ( em != null , "The entity manager cannot be null." ) ; requireArgument ( ids != null && ! ids . isEmpty ( ) , "IDs cannot be null or empty." ) ; requireArgument ( type != null , "The entity type cannot be null." ) ; TypedQuery < E > query = em . createNamedQuery ( "JPAEntity.findByPrimaryKeys" , type ) ; query . setHint ( "javax.persistence.cache.storeMode" , "REFRESH" ) ; try { query . setParameter ( "ids" , ids ) ; query . setParameter ( "deleted" , false ) ; return query . getResultList ( ) ; } catch ( NoResultException ex ) { return new ArrayList < > ( 0 ) ; } }
finds jpa entities by their primary keys .
