With this HQL query:
SELECT DISTINCT fs FROM FileStatus fs WHERE UPPER(STR(fs.filePath)) LIKE :FILE_PATH
I get:
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:637)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:74)
and with my named parameter FILE_PATH, the map has the following:
paramMap.put("FILE_PATH", "%PATHNAME%");
I have no idea why this is happening. To make things more confusing (or maybe this will help everyone), if I use a number in the file path, for example paramMap.put("FILE_PATH", "%23%");, it works fine.
The parameter map is passed to the DAO.read () method along with the request. Hibernate handles everything else. Something like that:
fileStatusDao.read(query, parameterMap);
Thanks in advance for your help.
source
share