Hello,
I think you wanted to write "true" instead of "false" in the last post.
I've tried your idea but it doesn't work.
Here's my HQL modification in the Page.hbm file:
Code:
<query name="FIND_BY_SITE_IN_FOLDER">
from Page as p
where p.SiteId = :site
and p.Path like :folder1
and p.Path not like :folder2
order by p.Name
</query>
Here's my Java code to call the HQL:Code:
namedQuery=QUERY_FIND_BY_SITE_IN_FOLDER;
Hashtable params=new Hashtable();
params.put("site", site.getId());
if (currentFolder!=null) {
params.put("folder1", currentFolder+"%");
params.put("folder2", currentFolder+"%/%");
}
List res=PageDAO.getInstance().getNamedQuery(namedQuery, params);
It doesn't throw me an Exception but the
SQL output is:
Code:
Hibernate: select page0_.id as id, page0_.nav_html as nav_html, page0_.include as include, page0_.page_template_id as page_tem4_, page0_.path as path, page0_.name as name, page0_.site_id as site_id from page page0_ where (page0_.site_id=? )and(page0_.path like ? )and(page0_.path not like ? ) order by page0_.name
I did a "step by step" debug and I saw that all parameters had the correct value.
Is it normal?
Should the SQL output mask the named parameters?
Anyway the returned List is empty...