I have Hibernate filters declared in .xml like these:
<filter name="login" condition="loginUsuario like '%' :loginParam '%'"/>
<filter name="pais" condition="nombreUniversidad in (select u.nombre from Universidad u where u.pais like :paisParam '%')"/>
Then in a DAO I call them:
if(filters.containsKey("usuario.login")){
getSession().enableFilter("login").setParameter("loginParam", filters.get("usuario.login"));
}
if(filters.containsKey("universidad.pais.nombre")){
getSession().enableFilter("pais").setParameter("paisParam", filters.get("universidad.pais.nombre"));
}
And then it comes the hql query:
List<Contrato> l=getSession.createQuery("select c from Contrato c").list();
The first one works fine but the second one fails. I've detected that filters with a subquery fail.
The weird thing is that at home both work fine but when i deploy the application where it must work, the second filter fails. I can not access to the logs or populate all the code with "System.out.println" because it is not development enviroment. I only send them a .WAR archive and they deploy it. I only know that second filter is not working because i see the screen output of filtered data.
I use the same technology at home (Tomcat 7.0.39 and Mysql 5.1.73) running in windows. Is a problem of the application server or Mysql server? Any other ideas?
I faced a similar issue using the fetch mode of subselect.
It seems there was a bug in hibernate-core and fixed in the latest version.
Here is the link
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.