TOUR表的父实体(TOUR_ID是主键)
@Entity
@Table(name = "TOUR")
public class TourEO implements Serializable{
@Id
@Column(name = "TOUR_ID")
private long tourId;
@OneToMany(mappedBy = "tourEO", cascade=CascadeType.ALL, fetch=FetchType.LAZY)
@Cascade(value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
private List<TourLocaleEO> tourLocale = new ArrayList<TourLocaleEO>();
...
}
为表格创建可嵌入的复合键
@Embeddable
public class TourLocalePK implements Serializable {
@ManyToOne
@JoinColumn(name = "TOUR_ID")
private TourEO tourEO;
@Column(name = "LOCALE")
private String locale;
...
}
TOUR_LOCALE表的子实体(TOUR_ID和LOCALE形成复合键,并注意TOUR_ID是来自父级的外键)
@Entity
@Table(name = "TOUR_LOCALE")
public class TourLocaleEO implements Serializable {
@EmbeddedId
private TourLocalePK tourLocalePK;
...
}
有了这个,jboss服务器无法启动。我无法共享日志(但我看到的没有太多相关错误)
有人能告诉我哪里出错了吗?