Unfortunately, we make heavy use of sessions, to create queries like thus:
Code:
String hql = "FROM ExecutionSummary WHERE datamartSeq=:seq order by endTime desc";
List list = getSession().createQuery(hql)
.setLong("seq",datamartSeq.longValue())
.setMaxResults(count)
.list();
and so:
Code:
Integer count = (Integer) getSession().
createQuery("select count(*) FROM FolderContent fc where fc.folder=:folder").
setEntity("folder", folder).uniqueResult();
I could have missed it, but I don't see a createQuery() method for HibernateTemplate:
http://<br />
<a href="http://www.s...html</a><br />
Is there another way to create queries? There are methods available via queries that have no equivalent in HibernateTemplate (like uniqueResult()).
Also (and I don't expect an answer to this, but maybe a comment), "Hibernate in Action", chapter 7, is chock-a-block full of using session to create queries. If the API says "don't do this", I can't understand why the authors of this book would use it anyway.
s.l.