unexpected char: '@' [from cn.mani123.domain.Order where product = cn.mani123.domain.Product@11d48a7

使用hibernate template查询时报错

unexpected char: '@' [from cn.mani123.domain.Order where product = cn.mani123.domain.Product@11d48a78 and account = cn.mani123.domain.Account@647a4fc8 and status = 5]; nested exception is org.hibernate.QueryException: unexpected char: '@' [from cn.mani123.domain.Order where product = cn.mani123.domain


原因:数据库中表使用外键,直接通过hql语句查询时查询的是哈希值,需要查找的hql有对象时,须使用

List list = this.getHibernateTemplate().find(hql,product,account);

product和account均为对象查询!


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部