我正在使用微服务架构的应用程序上工作,我有一个项目A,该项目的这个实体用户具有此代码
@JoinTable(
name = "USER_AUTHORITY",
joinColumns = { @JoinColumn(
name = "USER_ID",
referencedColumnName = "id") },
inverseJoinColumns = { @JoinColumn(
name = "AUTHORITY_ID",
referencedColumnName = "id") })
private List<Authority> authorities;
和另一个实体机构
@Entity
@Table(name = "AUTHORITY")
public class Authority {
@Id
@Column(name = "ID")
@GeneratedValue(strategy = GenerationType.SEQUENCE,
generator = "authority_seq")
@SequenceGenerator(name = "authority_seq",
sequenceName =
"authority_seq", allocationSize = 1)
private Long id;
@ManyToMany(mappedBy = "authorities", fetch = FetchType.LAZY)
private List<User> users;
}
我有一个项目B,它的实体AAA是以下代码:
@Entity
public class subUser extends User
因此,当我运行项目B时,出现以下错误:
org.hibernate.AnnotationException:使用@OneToMany或@ManyToMany定位未映射的类:com.A.model.User.authorities [com.A.model.Authority