I put the HQL query in an xml file like such:
Code:
<query name="imageprocessrequest.by.entityIdAndType">
FROM ImageProcessRequest WHERE entityType = :entityType AND entityId = :entityId
</query>
And changed the java code to use this query from the xml file like:
Code:
Map <String, Object> map = new HashMap<String, Object>();
map.put("entityType", obj.getClass().getSimpleName());
map.put("entityId", obj.getId().toString());
requests = dbdao.findByNamedQuery("imageprocessrequest.by.entityIdAndType", map);
where findByNamedQuery is:
Code:
public List<T> findByNamedQuery(String p_namedQuery, Map<String, Object> p_values)
{
Session session = this.getSession();
Query query = setQueryParams(session.getNamedQuery(p_namedQuery), p_values);
return findResults(query);
}
When I do the above my query works fine! I am still at a loss as to why this same query did not work before? Any Ideas?