Hello
Using hib 3.1.2.
I am using the generic hiberante dao solution desc here:
http://www.hibernate.org/328.html, but am having problems figuring out how to construct a sub query using the convenience method below:
Code:
/**
* Use this inside subclasses as a convenience method.
*/
@SuppressWarnings("unchecked")
protected List<T> findByCriteria(Criterion... criterion) {
Criteria crit = getSession().createCriteria(getPersistentClass());
for (Criterion c : criterion) {
crit.add(c);
}
return crit.list();
}
The function takes a Criterion object, but from the API I cannot see out to use this obect to create an 'association query'.
Creating an association query seems straight forward using Criteria (docs 12.4)
http://www.hibernate.org/hib_docs/reference/en/html/querycriteria.html, but this method accepts Criterion.
Question - using Criterion is it possible to query an association, if so how, if not then I'll simply change my design to accept a Criteria object instead.
regards
J.