Use of @OneToMany or @ManyToMany targeting an unmapped class

时间:2014-04-11 00:52:48   收藏:0   阅读:2965

昨天,在做一个项目的时候,发现了报出了这个问题:Use of @OneToMany or @ManyToMany targeting an unmapped class

然后自己找了很久发现,原来是配置文件<applicationContext.xml>出了问题,没有声明这个类:

<property name="annotatedClasses">
<list>
<value>com.itcast.oa.domain.Role</value>
<value>com.itcast.oa.domain.Department</value>
<value>com.itcast.oa.domain.User</value>
</list>
</property>

 

其次还报出的了这个问题:Associations marked as mappedBy must not define database mappings like @JoinTable or @JoinColumn

 一查才记起使用了(mappedBy)配置后是没办法和@JoinColumn或@JoinTable一起使用,用了这么久有点忘了这个:

@OneToMany(mappedBy="dept")
@JoinColumn//无法使用,会报错
public Set<User> getUsers() {
return users;
}

Use of @OneToMany or @ManyToMany targeting an unmapped class,布布扣,bubuko.com

原文:http://www.cnblogs.com/yhiloon/p/3656201.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!