Spring can be useful when setting things up like sharing a sleep / postgres connection, a transaction (if necessary), and how you get the HibernateSession object. In fact, using spring, you can use HibernateTemplates (the spring object), which will proxy a lot of things for you.
However, you still have the option of programming around the queries that you run. In this case, using HibernateTemplate you can write:
String parameter = "hello wOrlD" DetachedCriteria criteria = DetachedCriteria.forClass(objectClass) .add(Restrictions.ilike("name", parameter))); List<Object> result = template.findByCriteria(criteria);
or you can explore using Restrictions.eq or sqlRestriction to implement its sql fragment.
source share