public List getMenuListByUsername(String username)
{
try {
String queryString = "from tb_MENU as menu,tb_USER as user,tb_ROLE as role,tb_PURVIEW as purview where (user.ROLE_ID=role.ID and role.ID=purview.ROLE_ID and purview.MENU_ID=menu.ID) and user.name=?";
return getHibernateTemplate().find(queryString, username);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
但产生异常。
org.hibernate.hql.ast.QuerySyntaxException: tb_MENU is not mapped [from tb_MENU as menu,tb_USER as user,tb_ROLE as role,tb_PURVIEW as purview where (user.ROLE_ID=role.ID and role.ID=purview.ROLE_ID and purview.MENU_ID=menu.ID) and user.name=?]
在hibernate+spring结合项目中如何用多表查询????
------解决方案--------------------