0

我收到以下异常:

HTTP Status 500 - Request processing failed;
nested exception is org.springframework.orm.hibernate3.HibernateQueryException: expecting OPEN, found '.' near line 1, column 35 [from in.bets.crm.model.User u1, in.bets.crm.model.User u2 where u1.manager is not null and u2.manager.id = u1.id];
nested exception is org.hibernate.hql.ast.QuerySyntaxException: expecting OPEN, found '.' near line 1, column 35 [from in.bets.crm.model.User u1, in.bets.crm.model.User u2 where u1.manager is not null and u2.manager.id = u1.id]

我写了这样的查询:

users=hibernateTemplate.find("from User u1, User u2 where u1.manager is not null and u2.manager.id = u1.id");

请帮助解决此错误。谢谢

4

1 回答 1

0

试试这个:(刚刚添加了选择和加入关键字!)

users=hibernateTemplate.find("select u from User u inner join User m where u.manager is not null and u.manager.id = m.id");

于 2013-06-16T11:42:58.433 回答