code: public final <T> List<T> loadAllObjects(final Class<T> clazz) throws Exception {
          final Entity entityAnnotation = clazz.getAnnotation(Entity.class);
          if(entityAnnotation == null){
              throw new IllegalArgumentException("Unknown entity: " + clazz.getName());
          }
          
          return executeInTransaction(new Runnable<List<T>>() {
              @Override
              @SuppressWarnings("unchecked")
              public List<T> run(final EntityManager entityManager) {
  
                  final String fromEntity = entityAnnotation.name().isEmpty() ? clazz.getSimpleName() : entityAnnotation.name();
                  final String alias = fromEntity.toLowerCase();
  
                  return entityManager.createQuery("SELECT " + alias + " FROM " + fromEntity + " " + alias)
                          .getResultList();
              }
          });
      }
docs: Returns all objects of the given class in persistence context.
  
  @param <T>
  type of searched objects
  @param clazz
  type of searched objects
  @return list of found objects
  @throws IllegalArgumentException
  if the instance is not an entity
  @throws Exception
  selecting objects failed