解决SSH框架中hibernate根据多属性查询数据库报错:unexpected char :‘@’
问题描述
使用myeclipse工具对数据表进行逆向工程生成的DAO类中会有一个findByProperty方法:
public List findByProperty(String propertyName, Object value) {
log.debug("finding StudentCheck instance with property: "
+ propertyName + ", value: " + value);
try {
String queryString = "from StudentCheck as model where model."
+ propertyName + "= ?";
return getH

在SSH框架中,使用Hibernate进行多属性查询时遇到'unexpected char: '@'异常。问题源于findByProperty方法不适用于多属性查询。解决方法是改用带占位符的find方法,例如:`find('from Entity as e where e.property1=? and e.property2=?', [value1, value2])`,这样可以避免查询异常。"
133864591,20037181,WiFi标准演进:从802.11到WiFi 6E,"['无线技术', '802.11标准', 'WiFi 6E', '网络性能', '开发语言']
最低0.47元/天 解锁文章
529

被折叠的 条评论
为什么被折叠?



