使用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<Order> list = this.getHibernateTemplate().find(hql,product,account);
product和account均为对象查询!