最近我将我的项目从 Hibernate 版本 3.1 迁移到 4.3,为了获得更好的性能,我尝试使用注释而不是我的 xml 映射。我在继承类的所有实体类中都有以下异常。错误是“ org.休眠。MappingException“
我试图将 targetEntity 添加到 manytoOne 类并添加 @Access(AccessType.PROPERTY) 没有任何效果。更改为字段注释是不可能的,因为我有 150 多个实体类。我试图删除扩展类,它的@override 方法和异常不存在,但是,我需要添加使用它。
这是我的实体类
@Entity
@Table(name = "mapusergroups", catalog = "designdb")
public class Mapusergroups extends PlanroomMigrationEntity implements
java.io.Serializable {
private int idMapUserGroups;
private Groups groups;
private Users users;
public Mapusergroups() {
}
public Mapusergroups(Groups groups, Users users) {
this.groups = groups;
this.users = users;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "idMapUserGroups", unique = true, nullable = false)
public int getIdMapUserGroups() {
return this.idMapUserGroups;
}
public String getIdMapUserGroupsString() {
return "" + this.idMapUserGroups;
}
public void setIdMapUserGroups(int idMapUserGroups) {
this.idMapUserGroups = idMapUserGroups;
}
@ManyToOne(fetch = FetchType.LAZY, targetEntity = Groups.class)
@JoinColumn(name = "FK_idGroups", nullable = false)
@PlanroomMigrationEntity.PathUpToCompany
public Groups getGroups() {
return this.groups;
}
public void setGroups(Groups groups) {
this.groups = groups;
}
@ManyToOne(fetch = FetchType.LAZY, targetEntity = Users.class)
@JoinColumn(name = "FK_idUsers", nullable = false)
@PlanroomMigrationEntity.ReferenceToUser
public Users getUsers() {
return this.users;
}
public void setUsers(Users users) {
this.users = users;
}
@Override
public BaseWrapper<?> getWrapper() {
return new WMapUserGroups(this);
}
@Override
public PlanroomMigrationDAO getDao() {
return new MapUserGroupsDAO();
}
郎朗坤
相关分类