I have below method in my DAO class.
public PublishAction findbyLatestPublishedDate(int tcmURI,int pubID) throws StorageException
{
log.info("Entering Method: JPAPublishActionDAO.PublishAction.findbyLatestPublishedDate");
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("select pa from PublishAction pa where pa.id in(select pb.id from PublishAction pb where pb.ITEM_REFERENCE_ID=:tcmURI and pb.PUBLICATION_ID=:pubID and rownum <= 1 order by pb.LAST_PUBLISHED_DATE desc)");
Map<String, Object> queryParams = new HashMap<String, Object>();
queryParams.put("ITEM_REFERENCE_ID", tcmURI);
queryParams.put("PUBLICATION_ID", pubID);
log.debug("JPAPublishActionDAO findbyLatestPublishedDate -> queryBuilder- "+ queryBuilder.toString());
return executeQuerySingleResult(queryBuilder.toString(), queryParams);
}
It is giving below error:
2013-01-16 12:17:01,381 ERROR DeployPipelineExecutor - Original stacktrace for transaction: tcm:0-5607662-66560
java.lang.IllegalArgumentException: org.hibernate.QueryParameterException: could not locate named parameter [PUBLICATION_ID]
This is query generated by HQL internally in my logs:
2013-01-16 12:17:01,365 DEBUG QueryTranslatorImpl - SQL: select publishact0_.ID as ID66_, publishact0_.ITEM_REFERENCE_ID as ITEM2_66_, publishact0_.LAST_PUBLISHED_DATE as LAST3_66_, publishact0_.PUBLICATION_ID as PUBLICAT4_66_, publishact0_.ACTION as ACTION66_, publishact0_.FLAG as FLAG66_, publishact0_.ITEM_TYPE as ITEM7_66_, publishact0_.SCHEMA_ID as SCHEMA8_66_, publishact0_.URL as URL66_ from AUTN_ITEMS publishact0_ where publishact0_.ID in (select publishact1_.ID from AUTN_ITEMS publishact1_ where publishact1_.ITEM_REFERENCE_ID=? and publishact1_.PUBLICATION_ID=? and rownum<=1 order by publishact1_.LAST_PUBLISHED_DATE desc)
I can see the PUBLICATION_ID column exists in my entity as well as in my SQL Table.
Please suggest.