请问,这条语句的SQL语句错误在哪里,
Query q = session.createQuery("select * from firstphoto a where not exists(select * from firstphoto where album_id=a.album_id and id<a.id)");
当运行的时候错误是:
����: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: * near line 1, column 8 [select * from esp.model.firstphoto a where not exists(select * from esp.model.firstphoto where album_id=a.album_id and id<a.id)]
当我在mySQL中运行那条SQL语句时,是可以成功运行的。不知道为什么放到session.createQuery中就会错误呢
如果是Query q = session.createQuery("from firstphoto as firstphoto")
就可以正常运行也能正常显示view firstphoto的东西。
请大家帮我找找原因,谢谢~