我在spring中配置了自动扫描model层包的hibernate映射,但是昨天我加了权限认证类UsersRoles后,单元测试总显示org.hibernate.hql.ast.QuerySyntaxException: UsersRoles is not mapped,我在网上查了下,主要问题都集中在HQL语句中类小写,但是我自己核对了我的HQL语句,UsersRoles并没有写错,然后问题主要集中在了hibernate映射配置上,但是问题很奇怪,在model下的其他包都能映射,就只有UsersRoles不行,问题始终没有解决,所以希望各位指点一下。xml配置如下,
[code="java"]
com.sunshinez.oa.model
[/code]
UsersRoles类
[code="java"]
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
@Entity(name="t_usersroles")
public class UsersRoles {
[/code]
HQL语句为:"from UsersRoles u where u.user.userName = "+userName