Good night members of the forum! Interested in this question: How to pass a class through a variable or generic? Well, something like createCriteria (var.class) ...
public List<T> readAll() { Session session = null; List<T> obj = null; try{ session = HibernateUtil.getSessionFactory().openSession(); obj = session.createCriteria(T.class).list(); }catch (Exception e){ e.printStackTrace(); }finally { if(session != null && session.isOpen()) session.close(); } return obj; } Always in the field of generic T. class the error "Unknown class type" appears. Maybe there is an alternative? Thanks in advance!