Refactoring db jdbc hql