niks23 wrote:
ya correct you can do that for example
public interface xyzDao {
Person getxyz(String firstName, String... paths);
}
Here is what an implementation of this DAO may look like:
public class HibernateXyzDao implements xyzDao {
public Person getxyz(String firstName, String... paths) {
Session session = getSession();
Criteria criteriaQuery = session.createCriteria(resultClass);
criteriaQuery.add(Expression.eq("firstName", firstName));
setFetchModes(criteriaQuery, loadedPaths);
for(String eagerPath : paths) {
criteriaQuery.setFetchMode(eagerPath, FetchMode.JOIN);
}
return criteriaQuery.uniqueResult();
}
}
You would use this in your application like this:
XyzDao dao = // get person dao.
dao.getxyz("Jane", "mother", "children", "children.mother");
hope its works
Im afraid you have masked your code too much that it is difficult to understand.
It will be nice of you to repost it, with more complete and clear detail.
For example, what class is xyzDao? Is it a HibernateTemplate or a HibernateDaoSupport?
Please repost with more complete details.