Hibernate one to Many插入

时间:2015-02-24 06:52:01

标签: mysql hibernate

在我的位置表中,我有员工DO列表,员工表有locationid作为外键,如果我尝试使用ORM-insert插入位置DO,则locationid插入位置表但在员工表中为空。请帮我解决这个问题。提前谢谢

 @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy ="location")    
private List<Employee> employees = new ArrayList<Employee>();

@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinColumn(name = "locationid")
private Location location = null;

0 个答案:

没有答案