I can query a row with the id with the following code:
Session session = (Session) HibernateUtil.getSessionFactory().getCurrentSession();
transaction = session.beginTransaction();
result = (T) session.get(clazz, id);
But i want to achieve something different.
Why isnt it possible (or is it?) to declare a certain column and get all rows which match this columns value. Like this:
Session session = (Session) HibernateUtil.getSessionFactory().getCurrentSession();
transaction = session.beginTransaction();
result = (T) session.get(clazz, "column", "column_value");
It is easily to implement with Criteria API or HQL.
Suppose Hibernate doesn’t support to get entities by not id column, because of Unit Of Work and Identity Map patterns implementation with Hibernate L1 cache.
Also take into account differences between Session#get and Session#load methods.