if (treeEntity != null) {
//from {0} tree where tree.{1} = {2} and (select count(c) from {0} c where c.{3}.{4} = r.{4}) = {5}
String hql = MessageFormat.format(treeEntity.refreshHql(),
persistentContext.getEntityName(),
treeEntity.leafProperty(),
treeEntity.leafValue(),
treeEntity.parentProperty(),
persistentContext.getIdName(),
treeEntity.unleafValue());