I am using such code to select objects by id
Code:
T findByID(Serializable id) throws HibernateException {
T object = (T) HibernateUtils.getSession().createCriteria(clazz).add(Restrictions.idEq(id)).uniqueResult();
return object;
}
What is the right way to select in this way objects with composite id
Code:
<class name="Task" table="TASK" lazy="false">
<composite-id>
<key-many-to-one name="ClientSession" column="session_id"/>
<key-many-to-one name="BookieSource" column="source_id"/>
</composite-id>
</class>
Thanks !