SQL语句:
select u.userid,u.account,u.passwd,g.code,g.name,p.name,p.url,p.prvid from P_User_Ext u,
P_Group g,
P_Privilege p,
P_Group_Prv t  where g.groupid = u.groupid  and t.groupid=u.groupid and p.prvid = t.privilege and u.account='admin'在mysql中可以运行,但在hibernate中:
Query query = session.createQuery(sql);
错误显示:net.sf.hibernate.QueryException: could not resolve property: groupid of: com.infosys.Hibernate.PGroupPrv [select u.userid,u.account,u.passwd,g.code,g.name,p.name,p.url,p.prvid,t.groupid from com.infosys.Hibernate.PUserExt u,com.infosys.Hibernate.PGroup g,com.infosys.Hibernate.PPrivilege p,com.infosys.Hibernate.PGroupPrv t  where g.groupid = u.groupid  and t.groupid=u.groupid and p.prvid = t.privilege and u.account='admin']
at net.sf.hibernate.persister.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:38)
at net.sf.hibernate.hql.PathExpressionParser.getPropertyType(PathExpressionParser.java:249)
at net.sf.hibernate.hql.PathExpressionParser.end(PathExpressionParser.java:288)
at net.sf.hibernate.hql.WhereParser.doPathExpression(WhereParser.java:336)
at net.sf.hibernate.hql.WhereParser.doToken(WhereParser.java:366)
at net.sf.hibernate.hql.WhereParser.token(WhereParser.java:251)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:123)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:295)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1571)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1542)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at org.infosys.util.PrivilegeTree.searchPrv(PrivilegeTree.java:57)
at org.infosys.util.PrivilegeTree.main(PrivilegeTree.java:75)