hibernate改为annotation后事务不回滚了。

之前用hbm文件形式,但是改了annotation后事务不回滚,改回hbm映射文件的形式就好了,请高手指教。。




@Entity
@Table(name="oa_dept")
@org.hibernate.annotations.Entity(dynamicUpdate=true,dynamicInsert=true)
public class Dept implements java.io.Serializable {

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;
private String name;
private String man;
private String tel;
private String other;
@OneToMany(fetch=FetchType.EAGER) @JoinColumn(name="dept_id")
private Set<User> users;

public Set<User> getUsers() {
return users;
}
public void setUsers(Set<User> users) {
this.users = users;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMan() {
return man;
}
public void setMan(String man) {
this.man = man;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public String getOther() {
return other;
}
public void setOther(String other) {
this.other = other;
}
}

你可能感兴趣的:(Hibernate)