日期:2014-05-18 浏览次数:20826 次
public T getByHql(String hql, Map<String, Object> params) {
Query q = getCurrentSession().createQuery(hql);
if (params != null && !params.isEmpty()) {
for (String key : params.keySet()) {
q.setParameter(key, params.get(key));
}
}
List<T> l = q.list();
if (l != null && l.size() > 0) {
return l.get(0);
}
return null;
}
Struts Problem Report
Struts has detected an unhandled exception:
Messages:
could not locate named parameter [param71]
File: org/hibernate/engine/query/spi/ParameterMetadata.java
Line number: 100
————————————————————————————————————————————————————————————————
Stacktraces
org.hibernate.QueryParameterException: could not locate named parameter [param71]
org.hibernate.engine.query.spi.ParameterMetadata.getNamedParameterDescriptor(ParameterMetadata.java:100)
org.hibernate.engine.query.spi.ParameterMetadata.getNamedParameterExpectedType(ParameterMetadata.java:106)
org.hibernate.internal.AbstractQueryImpl.determineType(AbstractQueryImpl.java:466)
org.hibernate.internal.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:436)
teamFive.dao.impl.BaseDAOImpl.getByHql(BaseDAOImpl.java:61)
以下省略……