我建的ssh框架,在数据库links表的linksType属性是汉字(友情链接和合作企业),然后我就查询links表,只查询友情链接的内容,DAO层方法
public List findByLinksType(Object linksType) {
return findByProperty(LINKS_TYPE, linksType);
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding Links instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Links as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
然后我就调用findByLinksType(Object linksType)这个方法,在service层测试方法(看能不能查出来)是
public void typeLinksList(){
List list=linksDAO.findByLinksType(“友情链接”);
system.out.print(list); //这里就写输出吧,看对象是不是空
}
结果是查不出来,显示[]