spring3+hibernate3.3.5出现的问题

项目中使用spring3.0.3+hibernate3.3.5final,出现以下异常:


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z

一对多使用注解如下:

@Entity(name = "room")
public class Room {
@Id @Column(length=50)
@GeneratedValue(generator="system-uuid")
@GenericGenerator(name="system-uuid",strategy="uuid")
private String room_id;
@Column(length = 20)
private String room_type;
@Column(length = 30)
private String room_ip;
private Integer room_port;
@Column(length = 100)
private String room_name;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "room")
private List<RoomPartInfo> partInfos;
。。。
}


@Entity(name = "RoomPartInfo")
public class RoomPartInfo {
@Id
@Column(length = 50)
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")
private String part_id;

@Column(length = 30)
private String part_type;

@Column(length = 100)
private String part_name;

@ManyToOne(fetch = FetchType.EAGER, cascade = { CascadeType.PERSIST,
CascadeType.PERSIST })
@JoinColumn(name = "room_id", updatable = false)
private Room room;

private Byte part_addr;
。。。
}


解决办法:降低hibernate版本到3.3.2,问题解决!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值