![java](https://habrastorage.org/r/w120/webt/5a/7f/c4/5a7fc421810ca922341023.png)
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();
}