If I put the mappedBy element to the @OneToMany, the owned side (the many side) will never persist !
for example
@Entity public class Employee { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public Long id; public String name; @OneToMany(targetEntity=Address.class,mappedBy="employee") public List<Address> addresses; } @Entity public class Address { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public Long id; public String line; @ManyToOne public Employee employee; }
The address class will never persist !!