Java
- 2 ответа
- 0 вопросов
1
Вклад в тег
public static <T extends AbstractHibernateClass> T useLoadWithCriteria(Class<T> instance) {
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession();
Criteria criteria = session.createCriteria(instance);
criteria.add(Restrictions.eq("age", 25));
return = (T) criteria.uniqueResult();
}